[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FW: [netCDFJava #RUG-895669]: NetCDF Java API



Hi Ross:

Sorry for the long delay.

GRIB has a notion of "reference time" and "valid time". We use the earliest reference time in the collection for the time units string. The problem is that "reference time" doesnt always mean "run time", but if in your particular case it does, then you can use it. heres a test routine:

public static void main(String[] args) {
String s = "Hour since 2007-03-22T00:00:00Z";
CalendarDateUnit cdu = CalendarDateUnit.of(null, s);
System.out.printf("%s == %s%n base = %s or %s%n", s, cdu, cdu.getBaseCalendarDate(), cdu.getBaseDate());
}


One of the reasons it took me so long to answer is that Ive been considering adding an auxiliary time coordinate that would document the reference time. However, at this point its not going to happen soon.

thanks for your patience.

John

On 12/17/2012 2:45 AM, Callister, Ross wrote:
Hi John,

Season's Greetings!

Please could you let me know if you've had chance to look at this one yet?

All I really need to know now is if there is a way of extracting the Run Date 
from the Grib file using the api?

The only way I can see of doing it currently is to parse the String returned by the units 
attribute of the time variable.  This is working for me, but is a bit ugly and 
inefficient (i.e. converting "Hour since 2012-11-07T00:00:00.000Z" to a 
Calendar object).

Thanks,

Ross Callister
Met Office   FitzRoy Road   Exeter   Devon   EX1 3PB  United Kingdom
Tel: +44 (0)1392 886578  Mobile: +44 (0)7841 098979
Email: address@hidden, address@hidden



-----Original Message-----
From: Unidata netCDF Java Support [mailto:address@hidden
Sent: 26 November 2012 21:36
To: Callister, Ross
Cc: Rowe, Paul
Subject: [netCDFJava #RUG-895669]: NetCDF Java API

Hi Ross,

Sorry for the delay. We've been pretty focused the last few weeks on making 4.3 
stable release and had our Thanksgiving holiday last week. Unfortunately, we 
have a two day planning meeting tomorrow and Wednesday. So probably won't get 
back to you on this issue until later this week.

I'm assigning this ticket to John as he has done all our recent GRIB work.

Ethan

PS Say Hi to Pete for me.

Ross Callister wrote:
Hi guys,

I am currently working at the UK Met Office looking at reading GRIB1
files using your Java api (4.3.8 Beta).

It seems to work well, although I have run into a problem when trying
to access the Model Run Time for variables in the GRIB file.  I have
seen this data in the output of the NetcdfFile.getDetailedInfo()
method and it seems to come from the Grib1Iosp>  GribCollection>
GroupHcs>  TimeCoord class route (the runDate variable of the
TimeCoord class).  I need to know if it is possible to get the runDate
associated with a given variable using the API?

Also, if you have a file that has multiple GRIB run dates and or
co-ordinates, how do you differentiate between the variables e.g. what
would the following code return:

Variable timeVar = findVariable(dataFile, "time");

i.e. which variable's time would it fetch?


Thanks in advance,

Ross Callister


p.s. I'm working closely with Pete Trevelyan who I believe you know.

Ticket Details =================== Ticket ID: RUG-895669 Department: Support netCDF Java Priority: Urgent Status: Open



NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.