How are missing bounds handled in xarray and xcdat ? #411
Replies: 3 comments 4 replies
-
You have the option of adding bounds using I think the I don't think we have anything equivalent to |
Beta Was this translation helpful? Give feedback.
-
It strikes me as hard to automatically detect the bounds except in simple cases. If units are "months since xx" and the increment is 1, then clearly monthly or if "days since xx” and unit increment then clearly days. But if monthly data and the units are “day since xx” then you would probably have to crack the calendar etc.
What I would prefer is that you catch the problem and print out a clear error message. Like you need to run setAxisTimeBoundsXX etc.
M
… On Jan 25, 2023, at 7:40 PM, Stephen Po-Chedley ***@***.***> wrote:
In thinking about this discussion thread and @mfwehner <https://github.com/mfwehner>'s comment, I think xcdat should probably limit the current add_missing_bounds routine to latitude and longitude (this is currently applied to all axes that are missing bounds if add_bounds=True in xcdat.open_dataset) and implement some version of CDAT's setTimeBoundsFREQ. I played with CDAT v8.2 today and it does not automatically detect the appropriate frequency of missing time bounds (the user has to decide between setAxisTimeBoundsDaily, setAxisTimeBoundsMonthly, setAxisTimeBoundsYearly) – so the user needs to call one of these methods as appropriate. I'll add a feature request for this, but please add to the discussion if you have further comments on this.
—
Reply to this email directly, view it on GitHub <#411 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACSKCHE3KYFDHLV55BSYFGDWUHW4JANCNFSM6AAAAAAUGE4J7I>.
You are receiving this because you were mentioned.
|
Beta Was this translation helpful? Give feedback.
-
I have asked @oliviermarti and he thinks automatically generating bounds for |
Beta Was this translation helpful? Give feedback.
-
My apologies in this topic is already covered in xarray and xcdat documentation, just point me in the right direction! I confess I'm still not using xarray/xcdat and have only looked at very short sections of their documentation
Anyway, @mfwehner comment triggered some bounds' related questions. How are missing bounds handled by xarray and xcdat ?
In a perfect world, the netCDF files have perfect metadata and everything is handled as it should be, by default. In the real world, I indeed had to regularly use cdms2.setAutoBounds and
cdutil.setTimeBoundsXXXX
I have failed to find some online links to
cdutil.setTimeBoundsXXXX
documentation, so the best way is to have a look at the Old Documents I have put online (e.g. page 27 ofCDAT_Refresher_2010.pdf
, but there several other interesting references to bounds in this pdf), or at the docstringsGoogling
xarray dimensions bounds
helped me findT
orZ
(well there is not much that can be done for height/depth anyway), even if it's better than nothing (or is it? maybe missing bounds have to trigger a warning)Beta Was this translation helpful? Give feedback.
All reactions