Thanks, Mary. I'll give it a try. I don't know why my original email got
sent 3 times! Sorry!
-Bridget
On Thu, Jun 30, 2011 at 3:53 PM, Mary Haley <haley@ucar.edu> wrote:
> Bridget,
>
> I'm not positive about this, but if "dat" already has a time coordinate
> array attached to it, and that "time" coordinate array has a "description"
> attribute, then it will be retained, even when you do:
>
>     dat&time = t2
>
> Therefore, inside your loop, you might need to delete the description
> attribute from the time coordinate array attached to "dat" directly:
>
>         dat = fin->data(ii,:,:)
>
> . . .
>      delete(dat×@description)
>
> --Mary
>
> On Jun 30, 2011, at 4:23 PM, Bridget Thrasher wrote:
>
> I've got a file with 32 years of daily data that I'm breaking into files of
> individual years. The time variable in the original file has an incorrect
> "description" attribute that I am deleting. But when I write the new yearly
> file, the attribute reappears! I can figure out a work around, but I'd like
> to understand what I'm doing wrong. I'm running 5.2.0. Here is a code
> snippet followed by the screen output:
>
> CODE:
>
>     times = fin->day
>     delete_VarAtts(times,"description")
>     printVarSummary(times)
>     t = ut_calendar(times,-5)
>     strs = str_split(fin,"_")
>     vname = strs(0)
>     do y = 1979,2010
>         ii = ind(t(:,0).eq.y)
>         fname = strs(0)+"_"+y+".nc"
>         fout = addfile(fname,"c")
>         t2 = times(ii)
>         printVarSummary(t2)
>         dat = fin->data(ii,:,:)
>         dat!0 = "time"
>         dat!1 = "lat"
>         dat!2 = "lon"
>         dat&time = t2
>         fout->$vname$ = dat
>         delete(ii)
>         delete(dat)
>         delete(t2)
>         system("ncdump -h "+fname)
>     end do
>
>
> OUTPUT:
>
> Variable: times
> Type: float
> Total Size: 46752 bytes
>             11688 values
> Number of Dimensions: 1
> Dimensions and sizes:    [day | 11688]
> Coordinates:
>             day: [722816..734503]
> Number Of Attributes: 2
>   units :    days since 0001-01-01
>   calendar :    gregorian
>
>
> Variable: t2
> Type: float
> Total Size: 1460 bytes
>             365 values
> Number of Dimensions: 1
> Dimensions and sizes:    [day | 365]
> Coordinates:
>             day: [722816..723180]
> Number Of Attributes: 2
>   calendar :    gregorian
>   units :    days since 0001-01-01
>
> netcdf pr_1979 {
> dimensions:
>     time = 365 ;
>     lat = 200 ;
>     lon = 464 ;
> variables:
>     float pr(time, lat, lon) ;
>         pr:units = "mm" ;
>         pr:description = "Daily Accumulated Precipitation" ;
>         pr:_FillValue = -9999.f ;
>     float time(time) ;
>         time:units = "days since 0001-01-01" ;
>         time:calendar = "gregorian" ;
>         *time:description = "days since 1900-01-01" ;*
>     float lat(lat) ;
>         lat:units = "degrees_north" ;
>         lat:description = "Latitude of the center of the grid cell" ;
>     float lon(lon) ;
> }
>
>
> Any insight?
>
> --
> Bridget Thrasher, PhD
> Independent Contractor, Research Scientist
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
-- Bridget Thrasher, PhD Independent Contractor, Research ScientistReceived on Thu Jun 30 17:27:54 2011
This archive was generated by hypermail 2.1.8 : Tue Jul 12 2011 - 15:03:53 MDT