xradar icon indicating copy to clipboard operation
xradar copied to clipboard

Distinction between dataset variables and ancillary variables

Open egouden opened this issue 3 years ago • 6 comments

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

egouden avatar Apr 03 '23 14:04 egouden

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

kmuehlbauer avatar Apr 03 '23 15:04 kmuehlbauer

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

egouden avatar Apr 03 '23 20:04 egouden

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.

kmuehlbauer avatar Apr 04 '23 12:04 kmuehlbauer

What about using attributes to store these ancillary variables?

egouden avatar Apr 04 '23 14:04 egouden

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?

kmuehlbauer avatar Apr 04 '23 15:04 kmuehlbauer

There are actually 3 types of sweep variables:

  • observed variables
  • ancillary variables related to one or more observed variables
  • metadata variables related to the sweep itself

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

egouden avatar Apr 18 '23 07:04 egouden