Re: overwrite the attribute of time units

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 17 2012 - 08:43:55 MDT

Hi In-Won Kim,

I'm not sure I understand. Were you expecting the units to change directly on the file?
"time_to_newtime_ doesn't know anything about your file, so it's not going to change it.

You have to write the new "time" values back out to the file yourself:

  time = time_to_newtime(a, "days since 1999-01-01 00:00:00")
  in->time = time

--Mary

On Jul 17, 2012, at 6:32 AM, 김인원 wrote:

> Hello.
>
> I'm trying to change date information from original file.
>
> This is the information of original file.
>
> time ------> time:units = "days since 0000-01-01 00:00:00" ;
>
> I want to change 0000-01-01 00:00:00 to 1990-01-01 00:00:00.
>
> But, I failed to overwrite the time units.
>
> How do I modified my program to change the time units?
>
> ==============================================
> netcdf sst_HadOIBl_bc_0.47x0.63_clim_c061106_org {
> dimensions:
> lon = 576 ;
> lat = 384 ;
> time = UNLIMITED ; // (12 currently)
> variables:
> int date(time) ;
> date:long_name = "current date (YYYYMMDD)" ;
> int datesec(time) ;
> datesec:long_name = "current seconds of current date" ;
> double lon(lon) ;
> lon:long_name = "longitude" ;
> lon:units = "degrees_east" ;
> double lat(lat) ;
> lat:long_name = "latitude" ;
> lat:units = "degrees_north" ;
> double time(time) ;
> time:units = "days since 0000-01-01 00:00:00" ;
> time:calendar = "365_day" ;
> float ice_cov(time, lat, lon) ;
> ice_cov:long_name = "BCS Pseudo Sea-ice concentration" ;
> ice_cov:units = "fraction" ;
>
>
> Ncl code
> =============================================================
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> in = addfile("./sst_HadOIBl_bc_0.47x0.63_clim_c061106_org.nc","w")
>
> a= in->time
>
> time = time_to_newtime(a, "days since 1999-01-01 00:00:00")
>
> printVarSummary(time)
>
> end
>
>
>
>
> --
> --
> In-Won Kim
> Intergrated Climate System Modeling Lab.
> Department of Environmental Atmospheric Sciences
> 599-1 Daeyeon-dong, Nam-gu
> Pukyong National University,
> Busan, S.Korea
>
> Tel. +82-51-629-6643
> Fax +82-51-629-7991
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 17 08:44:06 2012

This archive was generated by hypermail 2.1.8 : Wed Jul 18 2012 - 14:33:00 MDT