[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #LIS-995615]: How to convert netcdf date into a human readable format
- Subject: [netCDF #LIS-995615]: How to convert netcdf date into a human readable format
- Date: Fri, 12 Feb 2010 13:28:30 -0700
Hi Aidong,
> I am a researcher in UC Davis. I am using fortran 90 code to read netcdf. I
> am stuck at converting date in my netcdf data to a human readable format.
>
> ------
> double Date(NB_MESURES) ;
> Date:long_name = "Date" ;
> Date:units = "seconds since 1900-01-01" ;
> ------
>
> Do you know any subroutine that can help me to read dates out?
If you have the "ncdump" program from any version of netCDF released after
October 2008, for example version 4.0.1 or 4.1, you can use the "-t"
flag from ncdump to see a human-readable form of time data. For example,
instead of
Date = 2839968000, 2840054400, 2840140800, 2840150000;
you would then see:
Date = "1989-12-30", "1989-12-31", "1990-01-01", "1990-01-01 02:33:20.000000" ;
There is no function in the netCDF API that does this directly, but you can
extract
such a function from ncdump/dumplib.c using the nctime_val_tostring() function,
though
you will have to pull out some other functions it calls from ncdump/nctime.c.
I hope this helps.
--Russ
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: LIS-995615
Department: Support netCDF
Priority: Normal
Status: Closed