[ncl-talk] error creating netcdf files
Wang, Yaoping
wang.3866 at buckeyemail.osu.edu
Fri Feb 26 12:45:06 MST 2016
Hello all,
I am using NCL to temporally concatenate MODIS evapotranspiration data and output them to netcdf. But some how the program keeps aborting:
**********
fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a variable to a file, check to make sure data type is supported by the output format
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 107 in file make_netcdf.ncl
**********
Here is a snippet of my codes:
**********
ET_1km = new( (/dimsizes(day), dimsizes(lat_pts), dimsizes(lon_pts)/), float ) ; time,lat,lon
do jj = 0,dimsizes(day)-1
f = addfile("./Y"+year(ii)+"/D"+day(jj)+"/MOD16A2.A"+year(ii)+ \
day(jj) + ".all.hdf.hdfeos", "r")
ET_MODIS = short2flt_hdf( f->ET_1km_MOD_Grid_MOD16A2 )
printVarSummary(ET_MODIS)
lat_MODIS = f->YDim_MOD_Grid_MOD16A2
lon_MODIS = f->XDim_MOD_Grid_MOD16A2
printVarSummary(lat_MODIS) ; degrees_north
printVarSummary(lon_MODIS) ; degrees_east, from -180 ~ 180
if (jj .eq. 0) then ; create weights the first time
(omitted)
end if
; re-grid
res = True
res at CopyVarAtts = False
res at CopyVarCoords = False
ET_1km(jj,:,:) = ESMF_regrid_with_weights( ET_MODIS, wgtFileName, res )
delete(ET_MODIS)
delete(lat_MODIS)
delete(lon_MODIS)
delete(f)
end do
ET_1km!0 = "time"
ET_1km!1 = "lat"
ET_1km!2 = "lon"
ET_1km&time = day
ET_1km&lat = lat_pts
ET_1km&lon = lon_pts
ET_1km at units = "km/m^2/8day or 5day6day"
ET_1km at _FillValue = 32767
ET_1km at long_name = "MOD16A2 -- MODIS Gridded 1KM 8-day Composite Evapotranspiration (ET)"
printVarSummary(ET_1km)
system("rm -f ./Y" + year(ii) + "/MOD16A2.A2000.all.nc")
ncdf = addfile( "./Y" + year(ii) + "/MOD16A2.A2000.all.nc", "c" )
; do not create global attributes
; create dimensions
filedimdef(ncdf, (/ "time","lat","lon" /), \
(/ -1, dimsizes(lat_pts), dimsizes(lon_pts)/), \
(/ True, False, False /) )
; create variables
ncdf->ET = ET_1km ; this is where error occurs
**********
>From my printed var summary I cannot see anything wrong.
**********
Variable: ET_1km
Type: float
Total Size: 4600 bytes
1150 values
Number of Dimensions: 3
Dimensions and sizes: [time | 46] x [lat | 5] x [lon | 5]
Coordinates:
time: [001..361]
lat: [30.62..34.4]
lon: [-112.5..-107.5]
Number Of Attributes: 5
long_name : MOD16A2 -- MODIS Gridded 1KM 8-day Composite Evapotranspiration (ET)
units : km/m^2/8day or 5day6day
missing_value : 32767
remap : remapped via ESMF_regrid_with_weights: Bilinear
_FillValue : 32767
**********
Could someone help? Thank you very much,
Yaoping Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160226/6b452e74/attachment.html
More information about the ncl-talk
mailing list