Deleted attribute reappears

From: Bridget Thrasher <bthrasher_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 30 2011 - 16:23:11 MDT

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
Received on Thu Jun 30 16:24:22 2011

This archive was generated by hypermail 2.1.8 : Tue Jul 12 2011 - 15:03:53 MDT