[ncl-talk] Strange units of time

Beáta Szabó-Takács szabo.b at czechglobe.cz
Wed May 30 09:56:48 MDT 2018


Hi Rick,

Thank you for your response. I use NCL in a server where NCL 6.3 and NCL 6.4.0 are installed. If I want to use NCL 6.4.0 I have to export NCARG_ROOT=/opt/ncl640 export PATH=$NCARG_ROOT/bin/:$PATH. To be honest I forgot to export. I checked it with NCL 6.4.0 as well and I got correct units. I checked the test.h5 in Panoply as well.



I do not understand why NCL and Panoply are not able to convert the serial date to date even though I add an attribute as units is days since 1971-01-01? I created also NetCDF file in Java based on https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/tutorial/NetcdfWriting.html and I used the same serial date number with same attribute and both Panoply and NCL are able to convert it to date. Is it possible that the matter is that the time can be declared as dimension in NetCDF file e.g:



Dimension timeDim = ncfile.addUnlimitedDimension("time");

Variable time = ncfile.addVariable(null, "time", DataType.DOUBLE, "time");

time.addAttribute( new Attribute("units", "days since 1970-01-01"));



but it is not possible in HDF5?

Thank you for your response in advance!

Best regards,

Beata


From: Rick Brownrigg [mailto:brownrig at ucar.edu]
Sent: Wednesday, May 30, 2018 3:15 PM
To: Beáta Szabó-Takács <szabo.b at czechglobe.cz>
Cc: ncl-talk (ncl-talk at ucar.edu) <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Strange units of time

Hi,
Its hard to say where the issue lies, offhand. Do you have other tools that can look at that HDF5 file, and is the odd units string absent there?
If so, what version of NCL are you using?  If you are using the latest, 6.4.0, are you able to send that HDF5 file to me? (either email directly, is not too large, or see the instructions about our FTP site:

   http://ncl.ucar.edu/ftp_files.shtml

)
Rick


On Wed, May 30, 2018 at 2:38 AM, Beáta Szabó-Takács <szabo.b at czechglobe.cz<mailto:szabo.b at czechglobe.cz>> wrote:
Dear NCL Users,
I wrote a HDF5 file in Java by IHDF5Writer http://svnsis.ethz.ch/doc/openbis/S176.0/ch/systemsx/cisd/hdf5/IHDF5Writer.html
Because IHDF5Writer can write timestamps as number of milliseconds since January 1, 1970, 00:00:00 GMT I converted the java.Util.Date to serial date number as days since 1970-01-01.

I wrote the time values into HDF5 file

writer.writeDoubleArray("time", time);

writer.string().setAttr("time", "units", "days since 1970-01-01");


I checked the resulted test.h5 in NCL and printed the time variable and I got the following result:

fn = "test.h5"

fi = addfile(fn, "r")

time = fi->time

time1 = time(0)

print(time1)


Variable: time1

Type: double

Total Size: 8 bytes

            1 values

Number of Dimensions: 1

Dimensions and sizes:   [1]

Coordinates:

Number Of Attributes: 1

  units :       days since 1970-01-01tyeratelatedofileion

(0)     17348.00006944444



Can someone let me know why ncl receive a strange units?


_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180530/69129369/attachment.html>


More information about the ncl-talk mailing list