[netcdf-java] Writing to a time variable

Hello!

I´m trying to write to a time variable on netcdf-java version 4.3.8.
Maybe a demo code would solve my problem, but I was unable to find
one.  So, can someone tell me if those are the steps to get this
working:

Initially:

* Create a time variable - type double
* Add to this variable attributes "calendar" and "units"

Now let´s say that I want to write today´s date to the variable then:

* Read the variable´s "calendar" and "units" attributes
* Build a CalendarDate object with the "base" date, i.e, the one from
units string
* Build a CalendarDate object with today´s date
* Subtract from today´s date the base date (in miliseconds or days)
* Store the above number on the variable

Is this the right script?

Assuming that the script is right, then I have some more questions:

* according to documentation "units" attribute should be a string of
the form: "days since 1990-01-01 0:0:0"
* Trying to parse this units string with CalendarDate.parseUdunits
does not work.  What method should I use?
* I managed to parse the following string with
CalendarDate.parseUdunits: parseUdunits("gregorian",
"2010-06-05T22:07:03.000Z"), but the result is nil and not a
CalendarDate object.


Going further with the question... I want this time variable to be a
coordinate variable. My measurements are not done on fixed periods,
i.e., I could make a measurements on 2010-01-01, 2010-01-05,
2010-01-06, 2010-01-09, 2010-01-11, etc.  My understanding is that I
should:

* time is an unlimited dimension and I should have a time(time) variable
* Store every measurement date on this variable
* Use the index of the time variable as the dimension for other
variables, so, date 2010-01-06 is the 3rd dimension.

Am I going the right way?


Thank you very much!

-- 
Rodrigo Botafogo



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