openradar / xradar

A tool to work in weather radar data in xarray
https://docs.openradarscience.org/projects/xradar
MIT License
85 stars 17 forks source link

Distinction between dataset variables and ancillary variables #104

Open egouden opened 1 year ago

egouden commented 1 year ago

I cannot find a way to distinguish between the dataset variables and ancillary variables.

kmuehlbauer commented 1 year ago

@egouden Could you please elaborate along an example? It's hard to guess what you are referring to.

egouden commented 1 year ago

For example, viewing all dataset variables. If one loops over data_vars, one also gets ancillary variables.

kmuehlbauer commented 1 year ago

xr.Dataset can only differentiate between coordinates (.coords ) and data variables (.data_vars). We can't do much about this on the xr.Dataset itself. What we might think about is an accessor which separates the data_vars and ancillary_vars.

print(ds.var.data_vars) # only data variables
print(ds.var.ancillary_vars) # only ancillary variables

But not sure, if this is worth the action.

egouden commented 1 year ago

What about using attributes to store these ancillary variables?

kmuehlbauer commented 1 year ago

Are you referring to those ancillary variables https://docs.openradarscience.org/projects/xradar/en/stable/datamodel.html#ancillary-variables?

It might not be possible as those variables are data variables in the underlying netcdf file.

Maybe can describe the use case you have in mind and why you need this separated?

egouden commented 1 year ago

There are actually 3 types of sweep variables:

Accessing only the observed variables should be a basic feature indeed. Is it not already needed in our code?