This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Don: Theres no way to make java.util.Date do the right thing for non-standard calendars. You have to use CoordinateAxis1DTime.getCalendarDates(). I am adding a deprecation on CalendarDate.toDate() to emphasize this. Thanks for reporting. John > I put this in the debugger and it looks like CalendarDate.toDate() is > not returning the right values (or at least what I would suspect are the > right values). For example, a CoordinateAxis1DTime with a 360_day > calendar shows CalendarDates (cdates) as: > > ..... > 1968-01-30T15:00:00.000Z, 1968-01-30T18:00:00.000Z, > 1968-01-30T21:00:00.000Z, 1968-02-01T00:00:00.000Z, > 1968-02-01T03:00:00.000Z, 1968-02-01T06:00:00.000Z, > 1968-02-01T09:00:00.000Z, 1968-02-01T12:00:00.000Z, > 1968-02-01T15:00:00.000Z, 1968-02-01T18:00:00.000Z, > 1968-02-01T21:00:00.000Z,.... > > But the corresponding Date objects created from CalendarDate.toDate() > (in CoordinateAxis1DTime.getTimeDates() - timeDates) end up as: > > ..... > Tue Jan 30 08:00:00 MST 1968, Tue Jan 30 11:00:00 MST 1968, > Tue Jan 30 14:00:00 MST 1968, Tue Jan 30 17:00:00 MST 1968, > Tue Jan 30 20:00:00 MST 1968, Tue Jan 30 23:00:00 MST 1968, > Wed Jan 31 02:00:00 MST 1968, Wed Jan 31 05:00:00 MST 1968, > Wed Jan 31 08:00:00 MST 1968, Wed Jan 31 11:00:00 MST 1968, > Wed Jan 31 14:00:00 MST 1968,.... > > (7 hour offset from Z time), whereas I would have expected them to be: > > ..... > Tue Jan 30 08:00:00 MST 1968, Tue Jan 30 11:00:00 MST 1968, > Tue Jan 30 14:00:00 MST 1968, Tue Jan 30 17:00:00 MST 1968, > Tue Jan 30 20:00:00 MST 1968, Tue Jan 30 23:00:00 MST 1968, > Thu Feb 01 02:00:00 MST 1968, Thu Feb 01 05:00:00 MST 1968, > Thu Feb 01 08:00:00 MST 1968, Thu Feb 01 11:00:00 MST 1968, > Thu Feb 01 14:00:00 MST 1968,.... > > Am I misunderstanding what CalendarDate.toDate() should be returning? > > Don > > > On 9/20/12 9:58 AM, Unidata netCDF Java Support wrote: > > > > Don Murray, > > > > Your Ticket has been received, and a Unidata staff member will review it > > and reply accordingly. Listed below are details of this new Ticket. Please > > make sure the Ticket ID remains in the Subject: line on all correspondence > > related to this Ticket. > > > > Ticket ID: JDB-235822 > > Subject: Fwd: non-standard calendars in the IDV > > Department: Support netCDF Java > > Priority: Normal > > Status: Open > > > > > > > > Please let us know how we can assist you further. > > > > Unidata User Support > > > > -- > Don Murray > NOAA/ESRL/PSD and CIRES > 303-497-3596 > http://www.esrl.noaa.gov/psd/people/don.murray/ > > Ticket Details =================== Ticket ID: JDB-235822 Department: Support netCDF Java Priority: Urgent Status: Open