[netcdf-java] Best practice for getting the initial (and/or final) time values of a Variable?

I would like to create a method that takes a NetCDF Variable as an argument
and returns the Variable's start time (or optionally the end time).  I can
imagine how I'd cook up such a method by getting the variable's time
dimension, then getting the start (or end) date using the time dimension's
units, etc., but it'll be several lines of code and I'm hoping that instead
someone has done this sort of thing before that I can reuse, or if not then
maybe there's a best practice that I could follow.

For example, I'd like to create a couple methods with the following
signatures (or something similar):

public Date getInitialDate(Variable variable);
public Date getFinalDate(Variable variable);

or more generally:

public Date getDate(Variable variable, int timeIndex);

Can anyone advise?  Thanks in advance for any suggestions.

--James
  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: