Closed hdsingh closed 5 years ago
In case of DataArray, since there is only single variable, Set coord
has not been implemented. For a DataSet
, it has been implemented.
In the Set Coords
tab, Cross selector displays all the variables preset in the DataSet. User selects the variable from left side and move them to right side by >>
button. After making selection, click on the Set Coords
button, which converts the vars to coords. Reverse operation (coord to var) is also possible.
We cannot reset the indexed_coords
.
Each time user clicks on the Set Coord
:
For each of dashboard
,control
,display
,describe
,fields
,coord_setter
, a method set_coords
has been implemented which performs necessary updates required in that particular panel.
In the fields panel, x
displays all the options (var_dims+non_indexed_coords
), while y
is selective.
var_dim
has been selected in x
, y
also displays var_dim
.non_indexed_coords
, dimensionality of two vars need to be same, so only the coords having same ndim
as x
are displayed in y
.If dims
have been selected, data.var.sel
method is used for plotting.
If coord
is selected, data.hvplot.quadmesh(x = 'coord1', y='coord2')
method has been used.
Please have a look by playing around with the interface.
@martindurant @rsignell-usgs Please review the changes.
@rsignell-usgs @martindurant Unlike dims
, in case of creating graph for a variable with respect to a coord
, Aggregations
would be empty. Also there doesn't seem any generalisable way to know beforehand, along what coords/vars index selectors would be generated. So is it fine if we are displaying both selector and player in the graph output?
@hdsingh, I was just about to comment on this. If coords like lon
and lat
are selected, it seems that aggregation along other dimensions like sigma
and time
should still work.
Yes, it seems that we can have aggregation for a variable along a dimension, even when x
and y
Select has coord
as options. I will check and implement this. But in this case Aggregation options will not include Select
and Animate
as option because we don't know beforehand for sure, if that dim along which we are aggregating, would be present in the generated index selectors or not.
We can have aggregation for a variable along a dimension, when x and y Select has coord
as options.
When a coord has been selected in x
and y
, we can only aggregate it along the dims which are not present in x
or y
. For example :
Var: temp
x: lat
y: lon
So now we can't aggregate along dims nx
and ny
since they are already present in lat
and lon
. Only aggregation only along remaining dims: time
and sigma
is possible.
@rsignell-usgs @martindurant Everything is working as expected. Please have a look.
With this latest commit, I'm getting:
(xrviz) C:\Users\rsignell\Documents\GitHub\xrviz\examples>python control_section.py
Traceback (most recent call last):
File "control_section.py", line 7, in <module>
dash = Dashboard(ds)
File "c:\users\rsignell\documents\github\xrviz\xrviz\dashboard.py", line 34, in __init__
self.control = Control(self.data)
AttributeError: 'Dashboard' object has no attribute 'data'
Now it is working. I will soon simplify the code using data = xr.Dataset({data.name: data}, attrs=data.attrs)
as discussed above.
With this latest commit
I will make a PR, perhaps after Wednesday's meeting, implementing Travis CI. We are probably starting to have enough functionality which is concrete that thorough testing is warranted.
@hdsingh, when I select lon
and lat
as coordinates, I get x=lat
, y=lon
by default. Is it possible to get x=lon
and y=lat
as default, or is it impossible to tell what should go where?
I understand that the user may choose to set whatever they want, but it would be nice to have sensible defaults if possible.
Yes correct defaults need to be set. I will look in detail how this could be done from this answer and will implement this in one of upcoming PRs. As of now options are being displayed according to their alphabetical order.
Now there is no separate handling for DataArrays
due to conversion into Dataset
while initialisation by data = xr.Dataset({data.name: data}, attrs=data.attrs)
.
@martindurant I have started writing tests. Please have a look and let me know if this looks fine. My aim here is to replicate the user behaviour and check if the interface is functioning as expected.
Yes, these tests look like a good start. I expect they are all passing. I'll merge this now, so we can discuss next steps tomorrow.
@rsignell-usgs @martindurant I have implemented set/reset coords and plot generation according to our discussion here . There were few points, which I did a bit differently. I would soon add a detailed description of the functionality implemented in this dashboard. In the mean time, please have a look at the interface.