html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/pull/523#issuecomment-131187220,https://api.github.com/repos/pydata/xarray/issues/523,131187220,MDEyOklzc3VlQ29tbWVudDEzMTE4NzIyMA==,2443309,2015-08-14T17:22:02Z,2015-08-14T17:22:02Z,MEMBER,"I submitted an feature request over at numpy.  I'm going to close this now.

@rabernat - thanks for the PR and keep them coming.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131178257,https://api.github.com/repos/pydata/xarray/issues/523,131178257,MDEyOklzc3VlQ29tbWVudDEzMTE3ODI1Nw==,1197350,2015-08-14T16:51:27Z,2015-08-14T16:51:27Z,MEMBER,"I am the least knowledgeable person here regarding numpy and pandas development. The issues should probably be opened by someone else.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131174556,https://api.github.com/repos/pydata/xarray/issues/523,131174556,MDEyOklzc3VlQ29tbWVudDEzMTE3NDU1Ng==,1217238,2015-08-14T16:40:13Z,2015-08-14T16:40:13Z,MEMBER,"Calendar support is numpy is conceivable, but it will pretty much require fixing numpy dtypes first so that they can be parametrized and extended by third parties in Python (this is on the roadmap). Right now the datetime64 type itself is pretty buggy, in large part because it's written in C code that nobody is maintaining.

.

For pandas, I think the bigger issue is that pandas only does datetime64 with ns resolution. Simply adding us support would go a long ways toward solving this. See here for some discussion on the pandas side: https://github.com/pydata/pandas/issues/7307

On Fri, Aug 14, 2015 at 9:17 AM, Joe Hamman notifications@github.com
wrote:

> > Worth? Yes. Any hope to actually get it in there? No...
> > I think I disagree.  There is almost no chance anyone outside of the climate community is going to spend time on this but, if calendar support was added in a responsible way to numpy and pandas, I don't see why they wouldn't be interested.  So it will need to come from the climate users community, which IMHO, is under represented in the dev community.
> > 
> > ## If you don't want open the issue, I will.
> > 
> > Reply to this email directly or view it on GitHub:
> > https://github.com/xray/xray/pull/523#issuecomment-131166492
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131171459,https://api.github.com/repos/pydata/xarray/issues/523,131171459,MDEyOklzc3VlQ29tbWVudDEzMTE3MTQ1OQ==,950575,2015-08-14T16:31:40Z,2015-08-14T16:31:40Z,CONTRIBUTOR,"@jhamman sorry for making this thread longer than it should.  But I don't think you disagree! You are just more optimist than I am  :wink:

But you are right.  We need a champion from the climate community.  And if either of you open the issue I will be the [second man](https://www.youtube.com/watch?v=fW8amMCVAJQ) on the hill.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131166492,https://api.github.com/repos/pydata/xarray/issues/523,131166492,MDEyOklzc3VlQ29tbWVudDEzMTE2NjQ5Mg==,2443309,2015-08-14T16:17:10Z,2015-08-14T16:17:10Z,MEMBER,"> Worth? Yes. Any hope to actually get it in there? No...

I think I disagree.  There is almost no chance anyone outside of the climate community is going to spend time on this but, if calendar support was added in a responsible way to numpy and pandas, I don't see why they wouldn't be interested.  So it will need to come from the climate users community, which IMHO, is under represented in the dev community.

If you don't want open the issue, I will.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131109392,https://api.github.com/repos/pydata/xarray/issues/523,131109392,MDEyOklzc3VlQ29tbWVudDEzMTEwOTM5Mg==,950575,2015-08-14T13:44:39Z,2015-08-14T13:44:39Z,CONTRIBUTOR,"> Regarding the non-standard calendar support, is it worth opening issues in numpy / pandas?

Worth? Yes.  Any hope to actually get it in there?  No...
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131109207,https://api.github.com/repos/pydata/xarray/issues/523,131109207,MDEyOklzc3VlQ29tbWVudDEzMTEwOTIwNw==,1197350,2015-08-14T13:43:32Z,2015-08-14T13:43:32Z,MEMBER,"Regarding the non-standard calendar support, is it worth opening issues in numpy / pandas?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131105515,https://api.github.com/repos/pydata/xarray/issues/523,131105515,MDEyOklzc3VlQ29tbWVudDEzMTEwNTUxNQ==,950575,2015-08-14T13:25:27Z,2015-08-14T13:25:27Z,CONTRIBUTOR,"> I want to teach xray in my fall physical oceanography class

@rabernat I hear you!  I suffer from the same problem.  But I think we should teach students how to defend themselves from bad practices and tools limitations.  (We have both in there!  Talking about non-standard calendar and accepted but non-recommended standards.)

> 3) Use xray without time support

Not ideal but that is probably the way to go.  My guess is that you can load the data in xray, but you cannot get those dates into the pandas indexing machinery, right? That is not too bad since there are not many ""dates operations"" that you can do anyway.  Most of the time we only need to translate the time information into a label for the figures. If that is the case you are OK with the tools we have now.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-131095419,https://api.github.com/repos/pydata/xarray/issues/523,131095419,MDEyOklzc3VlQ29tbWVudDEzMTA5NTQxOQ==,1197350,2015-08-14T12:43:47Z,2015-08-14T12:43:47Z,MEMBER,"Ok, thanks for the thoughtful discussion. I understand why you both feel this shouldn't be implemented in xray. My one objection to the discussion is that I don't think that climatological time is such a ""niche"" issue--processing climate model output (much of which has no specific calendar date associated with it but still has seasonal cycles, etc.) seems like one of the most useful applications for xray.

I come at this from a very practical point of view. I _need_ to use certain datasets (e.g. WOA13, POP model output) for my research and teaching. I _want_ to teach xray in my fall physical oceanography class---it is perfect for teaching because it ""just works"" and allows students to quickly load data and do basic analysis easily. This PR request would allow me to do that. I understand the counter-arguments, but I don't know exactly how I should proceed if this can't be part of xray. The options seem to be:

1) Don't use the datasets
2) Don't use xray
3) Use xray without time support

Is there something else I'm missing?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-130868683,https://api.github.com/repos/pydata/xarray/issues/523,130868683,MDEyOklzc3VlQ29tbWVudDEzMDg2ODY4Mw==,950575,2015-08-13T22:38:57Z,2015-08-13T22:38:57Z,CONTRIBUTOR,"> @ocefpaf To be clear, by ""strongly prefer to get this fix upstream"" I mostly meant that I am reluctant to include this in xray.

Great.  We don't need another interpretation of the CF-standards out there!

See the [WOA13](http://data.nodc.noaa.gov/thredds/dodsC/woa/WOA13/DATAv2/temperature/netcdf/decav/1.00/woa13_decav_t16_01v2.nc.html) dataset above as an example of the problems this brings. The data has no calendar and use units `months since`.  CF discourage the use of [months](https://github.com/Unidata/netcdf4-python/issues/434) for obvious reasons and no calendar translates to:

>  gregorian or standard Mixed Gregorian/Julian calendar as defined by Udunits.

Which one!  Year zero is invalid in one and (kind of) accepted in the other!!

Long story short: the dataset is valid CF but it is unclear how to interpret the dates.  No one cares because people using that dataset know that `t16` means Autumn (Oh no wait!! I am in the South Hemisphere, so that means Spring :stuck_out_tongue_winking_eye:)

PS: Note that there is a `none` calendar too in the CF conventions that is more adequate for datasets like that.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-130863487,https://api.github.com/repos/pydata/xarray/issues/523,130863487,MDEyOklzc3VlQ29tbWVudDEzMDg2MzQ4Nw==,1217238,2015-08-13T22:11:51Z,2015-08-13T22:11:51Z,MEMBER,"@ocefpaf To be clear, by ""strongly prefer to get this fix upstream"" I mostly meant that I am reluctant to include this in xray.

I _would_ like it to be straightforward for others to extend our reading capabilities for netcdfs by adding custom logic like this for their own equivalent of `xray.open_dataset` that builds on what we have in xray.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-130840069,https://api.github.com/repos/pydata/xarray/issues/523,130840069,MDEyOklzc3VlQ29tbWVudDEzMDg0MDA2OQ==,950575,2015-08-13T20:52:28Z,2015-08-13T21:01:31Z,CONTRIBUTOR,"Just so you see how messy this can be.  The year `0000`, because it does not exist, is used to store climatology in COARDS and CF.  The `coards` package issued a warning but did the wrong thing:

``` python
from coards import parse
units = 'days since 0000-01-01 00:00:00'
parse(0, units)
coards/__init__.py:60: UserWarning: Shifted data 366 days to the future, since year zero does not exist.
  UserWarning)
datetime.datetime(1, 1, 1, 0, 0)
```

If someone accidentally saves that date back with this object it will no longer be year 0 and other CDMs might choke by not recognizing it as climatology.  `cf_units` does the right thing:

``` python
import cf_units
u = cf_units.Unit('days since 0000-01-01 00:00:00', calendar=cf_units.CALENDAR_NO_LEAP)
ut = u.utime()
ut.num2date(0)
0-01-01 00:00:00
```

But that object is pretty much useless for pandas and xray because of the non-standard calendar.  The object **is** useful to annotate plots or to save the data metadata back the same way it was before.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-130827459,https://api.github.com/repos/pydata/xarray/issues/523,130827459,MDEyOklzc3VlQ29tbWVudDEzMDgyNzQ1OQ==,950575,2015-08-13T20:17:10Z,2015-08-13T20:35:08Z,CONTRIBUTOR,"> I would also strongly prefer to get this fix in netCDF4 upstream rather than in xray, if possible.

I disagree.  Maybe not even xray should ""fix"" this.  There are two issues here:

1) Interpreting year 0 as 1;
2) Non-standard calendars.

Maybe (2) should be in `np.datetime64` (and pandas), but even that is hard to become a reality due to its niche use.

(1) is an UDUNITS ~~aberration~~ interpretation that made into some Conventions (CF and [COARDS](http://ferret.wrc.noaa.gov/noaa_coop/coop_cdf_profile.html)) and does not belong in the netCDF4 package.  Does xray wants to became a CF CDM?  I sure hope not!  I have iris for that but for **everything** else I use xray.

And if people really want to get those niche date specification from xray they can just read the raw time data and parse it using  one of the several UDUNITS wrappers or convention compliance/checkers out there. Here is another one that should do the right thing here for that case: https://pypi.python.org/pypi/coards/1.0.5
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-130493686,https://api.github.com/repos/pydata/xarray/issues/523,130493686,MDEyOklzc3VlQ29tbWVudDEzMDQ5MzY4Ng==,1217238,2015-08-13T01:00:28Z,2015-08-13T01:00:28Z,MEMBER,"I would also strongly prefer to get this fix in netCDF4 upstream rather than in xray, if possible.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-130424018,https://api.github.com/repos/pydata/xarray/issues/523,130424018,MDEyOklzc3VlQ29tbWVudDEzMDQyNDAxOA==,1197350,2015-08-12T19:45:42Z,2015-08-12T19:45:42Z,MEMBER,"Here is another example of a dataset with a similar time encoding issue. This is a valid OpenDAP URL:
http://data.nodc.noaa.gov/thredds/dodsC/woa/WOA13/DATAv2/temperature/netcdf/decav/1.00/woa13_decav_t16_01v2.nc

The time units are 'months since 0000-01-01 00:00:00'. This is the very popular [World Ocean Atlas](https://www.nodc.noaa.gov/OC5/woa13/). Since it is a monthly climatology, the dates are referenced to year 0.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-129484020,https://api.github.com/repos/pydata/xarray/issues/523,129484020,MDEyOklzc3VlQ29tbWVudDEyOTQ4NDAyMA==,950575,2015-08-10T15:06:09Z,2015-08-10T15:15:11Z,CONTRIBUTOR,"@rabernat here is an example on how to read those dates using `cf_units` (big download for a small example :wink:):

http://nbviewer.ipython.org/gist/ocefpaf/d14bd8ad24f4e1a47b19

My point with this example is:  `netCDF4-python` should not do that for you!  And, of `xray` wants to go down that road, it must be done with some warnings and good documentation!

By accepting these rules (by rules I mean how UDUNITS interprets the dates and how that interpretation is part of the CF-convention) you are leaving the world of ""read my data"" and entering a world of ""interpret my data.""

`cf_units` interprets your data as CF-compliant and does what you expect from that Common Data Model.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-129268281,https://api.github.com/repos/pydata/xarray/issues/523,129268281,MDEyOklzc3VlQ29tbWVudDEyOTI2ODI4MQ==,1197350,2015-08-10T01:22:22Z,2015-08-10T01:22:22Z,MEMBER,"@ocefpaf Unfortunately no OPenDAP endpoint, but I put a sample file on our ftp server
ftp://ftp.ldeo.columbia.edu/pub/rpa/pop_sample/b40.1850.track1.2deg.wcm.007.pop.h.0100-01.nc
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-129190478,https://api.github.com/repos/pydata/xarray/issues/523,129190478,MDEyOklzc3VlQ29tbWVudDEyOTE5MDQ3OA==,950575,2015-08-09T14:15:15Z,2015-08-09T14:15:15Z,CONTRIBUTOR,"> @ocefpaf NCAR is one of the lead institutions in terms of the CF conventions. Yet the CESM POP model, also developed at NCAR, has this ""year 0"" issue! To me this suggests that any practical, real-world application will need to deal with special cases like this one.

I know :wink: that is why I use `cf_units`!

PS: do you have an OPenDAP endpoint for you data?  I would like to make a few tests here.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-129165156,https://api.github.com/repos/pydata/xarray/issues/523,129165156,MDEyOklzc3VlQ29tbWVudDEyOTE2NTE1Ng==,950575,2015-08-09T10:46:36Z,2015-08-09T14:14:08Z,CONTRIBUTOR,"Note that I am not questioning the validity of those dates neither its use.  But they are out there and people need to deal with that ~~monstrosity~~ feature.  If xray decides to support this it has to be implemented very carefully and with some warnings...
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-129190075,https://api.github.com/repos/pydata/xarray/issues/523,129190075,MDEyOklzc3VlQ29tbWVudDEyOTE5MDA3NQ==,1197350,2015-08-09T14:09:47Z,2015-08-09T14:09:47Z,MEMBER,"@ocefpaf NCAR is one of the lead institutions in terms of the CF conventions. Yet the CESM POP model, also developed at NCAR, has this ""year 0"" issue! To me this suggests that any practical, real-world application will need to deal with special cases like this one. 
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-129163306,https://api.github.com/repos/pydata/xarray/issues/523,129163306,MDEyOklzc3VlQ29tbWVudDEyOTE2MzMwNg==,950575,2015-08-09T10:42:08Z,2015-08-09T10:46:08Z,CONTRIBUTOR,"> Can you point me to where in the CF Conventions or UDUNITS the valid time coordinate units defined?

This edge case is defined here: http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html#climatological-statistics

NB: People that follow the COARDS conventions will also need this.  Any Udunits wrapper can deal with that for you:

``` python
import cf_units
u = cf_units.Unit('days since 0000-01-01 00:00:00', calendar=cf_units.CALENDAR_NO_LEAP)
ut = u.utime()
# Returns a fake datetime object (See http://scitools.org.uk/iris/docs/latest/iris/iris/unit.html#iris.unit.Unit.num2date)
ut.num2date(0)
0-01-01 00:00:00
# Note that python datetime cannot take year = 0, but udunits did the ""right"" thing.
ut.date2num(datetime(1, 1, 1))
365.0
```

> We should think about whether or not this fix belongs in xray or netCDF4. I am of the opinion that if the CF Conventions do in fact support the units in question, we should apply this fix in the netCDF package. If they don't, I don't think we wan to support it here either.

I strongly disagree with that.  netCDF is not **one** CDM and should not follow the CF-conventions!  I know that iris does follow CF very closely (annoyingly in fact) and xray ""kind of"" follow (which is great BTW).  However, if such conventions were adopted in the netCDF package, how will we load non-CF files?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237
https://github.com/pydata/xarray/pull/523#issuecomment-129101660,https://api.github.com/repos/pydata/xarray/issues/523,129101660,MDEyOklzc3VlQ29tbWVudDEyOTEwMTY2MA==,2443309,2015-08-09T03:43:09Z,2015-08-09T03:43:09Z,MEMBER,"I have a few general comments,  
1.  Can you point me to where in the [CF Conventions](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html#time-coordinate) or [UDUNITS](http://www.unidata.ucar.edu/software/udunits/#documentation) the valid time coordinate units defined?
2.  We should think about whether or not this fix belongs in xray or netCDF4.  I am of the opinion that if the CF Conventions do in fact support the units in question, we should apply this fix in the netCDF package. If they don't, I don't think we wan to support it here either.
3.  @shoyer is out for a bit but he will almost certainly want to weigh in on this.

If we end up going this route, you'll want to add some unit tests in [test_conventions.py](https://github.com/xray/xray/blob/master/xray/test/test_conventions.py#L234-L254).
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,99847237