Problems writing NetCDF4 file

From: Bridget Thrasher <bthrasher_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 07 2012 - 14:03:30 MST

I am getting an error that I don't understand and cannot seem to get around
when trying to write out a file with a NetCDF4 format. Can anyone explain
this to me? Here is my output with the error followed by the pertinent code
snippets:

 Copyright (C) 1995-2011 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.0.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: new_t
Type: double
Total Size: 29216 bytes
            3652 values
Number of Dimensions: 1
Dimensions and sizes: [time | 3652]
Coordinates:
Number Of Attributes: 6
  standard_name : time
  long_name : time
  axis : T
  calendar : gregorian
  units : days since 1850-01-01
  _FillValue : 9.969209968386869e+36

(0) writing file
ncattput: ncid 131072: NetCDF: Attempt to define fill value when data
already exists.
fatal:Attempt to delete undefined attribute from variable
warning:FileWriteVarVar: Could not write attribute (_FillValue) to variable
(time) in file
(regridded_2deg_tasmin_day_bcc-csm1-1_historical_r1i1p1_19500101-19591231),
continuing anyway
ncendef: ncid 131072: NetCDF: Can't open HDF5 attribute
ncendef: ncid 131072: NetCDF: Can't open HDF5 attribute
(0) file written

setfileoption("nc","Format","NetCDF4Classic")
 setfileoption("nc","CompressionLevel",5) ; 0 through 9 possible

t = fin->time
 ut = ut_calendar(t,-5)
ii = ind(isleapyear(ut(:,0)).and.ut(:,1).eq.2.and.ut(:,2).eq.28)
 n = dimsizes(ii)
dims = dimsizes(agggcm)
new_agggcm = new((/dims(0)+n,dims(1),dims(2)/),float,fill)
 new_ut = new((/dimsizes(t)+n,6/),typeof(ut))
new_t = new((/dimsizes(t)+n/),typeof(t))
 new_agggcm(:ii(0),:,:) = agggcm(:ii(0),:,:)
new_ut(:ii(0),:) = ut(:ii(0),:)
 do i = 0,n-1
new_agggcm(ii(i)+1+i,:,:) = (agggcm(ii(i),:,:) + agggcm(ii(i)+1,:,:))/2.
 new_ut(ii(i)+1+i,:) =
(/ut(ii(i)+i,0),2,29,ut(ii(i)+i,3),ut(ii(i)+i,4),ut(ii(i)+i,5)/)
if (i.lt.n-1) then
 new_agggcm(ii(i)+2+i:ii(i+1)+1+i,:,:) = agggcm(ii(i)+1:ii(i+1),:,:)
new_ut(ii(i)+2+i:ii(i+1)+1+i,:) = ut(ii(i)+1:ii(i+1),:)
 end if
end do
 new_agggcm((ii(n-1)+n+1):,:,:) = agggcm(ii(n-1)+1:,:,:)
new_ut((ii(n-1)+n+1):,:) = ut(ii(n-1)+1:,:)
 new_t =
ut_inv_calendar(new_ut(:,0),new_ut(:,1),new_ut(:,2),new_ut(:,3),new_ut(:,4),new_ut(:,5),t@units
,0)
 new_agggcm!0 = "time"
new_agggcm!1 = "lat"
new_agggcm!2 = "lon"
 new_t!0 = "time"
copy_VarAtts(t,new_t)
new_t@calendar = "gregorian"
 if (isatt(new_t,"bounds")) then delete(new_t@bounds) end if
printVarSummary(new_t)
 copy_VarAtts(agggcm,new_agggcm)
new_agggcm&time = new_t
print("writing file")
 fout->$var$ = new_agggcm
print("file written")

-- 
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 Wed Mar 7 11:03:40 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 13 2012 - 14:00:14 MDT