<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:'Times New Roman', Times, serif;">
<p>Sorry. I figured out the problem. The day dimension assigned to ET_1km was non-numeric. </p>
<br>
Yaoping Wang<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Wang, Yaoping<br>
<b>Sent:</b> Friday, February 26, 2016 14:45<br>
<b>To:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> error creating netcdf files</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:'Times New Roman',Times,serif">
<p>Hello all, </p>
<p><br>
</p>
<p>I am using NCL to temporally concatenate MODIS evapotranspiration data and output them to netcdf. But some how the program keeps aborting: </p>
<p><br>
</p>
<p><span style="font-family:'Times New Roman',Times,serif,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size:16px">**********</span><br>
</p>
<p></p>
<div>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</div>
<div>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 107 in file make_netcdf.ncl</div>
<p><span style="font-size:12pt">**********</span><br>
</p>
<p></p>
<p><br>
</p>
<p>Here is a snippet of my codes: </p>
<p></p>
<p style="font-family:'Times New Roman',Times,serif,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size:16px">
</p>
<p><span style="font-size:12pt">**********</span></p>
<p></p>
<p></p>
<div> ET_1km = new( (/dimsizes(day), dimsizes(lat_pts), dimsizes(lon_pts)/), float ) ; time,lat,lon</div>
<div><br>
</div>
<p></p>
<p></p>
<div> do jj = 0,dimsizes(day)-1</div>
<div> f = addfile("./Y"+year(ii)+"/D"+day(jj)+"/MOD16A2.A"+year(ii)+ \</div>
<div> day(jj) + ".all.hdf.hdfeos", "r")</div>
<div><br>
</div>
<div> ET_MODIS = short2flt_hdf( f->ET_1km_MOD_Grid_MOD16A2 )</div>
<div><br>
</div>
<div> printVarSummary(ET_MODIS)</div>
<div><br>
</div>
<div> lat_MODIS = f->YDim_MOD_Grid_MOD16A2</div>
<div> lon_MODIS = f->XDim_MOD_Grid_MOD16A2</div>
<div><br>
</div>
<div> printVarSummary(lat_MODIS) ; degrees_north</div>
<div> printVarSummary(lon_MODIS) ; degrees_east, from -180 ~ 180</div>
<div><br>
</div>
<div> if (jj .eq. 0) then ; create weights the first time</div>
<div> (omitted)</div>
<div> end if</div>
<div>
<div><br>
</div>
<div> ; re-grid</div>
<div> res = True</div>
<div> res@CopyVarAtts = False</div>
<div> res@CopyVarCoords = False</div>
<div> ET_1km(jj,:,:) = ESMF_regrid_with_weights( ET_MODIS, wgtFileName, res )</div>
<div><br>
</div>
<div> delete(ET_MODIS)</div>
<div> delete(lat_MODIS)</div>
<div> delete(lon_MODIS)</div>
<div> delete(f)</div>
<div> end do</div>
<div><br>
</div>
<div> ET_1km!0 = "time"</div>
<div> ET_1km!1 = "lat"</div>
<div> ET_1km!2 = "lon"</div>
<div> ET_1km&time = day</div>
<div> ET_1km&lat = lat_pts</div>
<div> ET_1km&lon = lon_pts</div>
<div> ET_1km@units = "km/m^2/8day or 5day6day"</div>
<div> ET_1km@_FillValue = 32767</div>
<div> ET_1km@long_name = "MOD16A2 -- MODIS Gridded 1KM 8-day Composite Evapotranspiration (ET)"</div>
<div><br>
</div>
<div> printVarSummary(ET_1km)</div>
<div><br>
</div>
<div>
<div> system("rm -f ./Y" + year(ii) + "/MOD16A2.A2000.all.nc")</div>
<div> ncdf = addfile( "./Y" + year(ii) + "/MOD16A2.A2000.all.nc", "c" )</div>
<div><br>
</div>
<div> ; do not create global attributes</div>
<div> ; create dimensions</div>
<div> filedimdef(ncdf, (/ "time","lat","lon" /), \</div>
<div> (/ -1, dimsizes(lat_pts), dimsizes(lon_pts)/), \</div>
<div> (/ True, False, False /) )</div>
<div><br>
</div>
<div> ; create variables</div>
<div> ncdf->ET = ET_1km ; this is where error occurs</div>
</div>
<p style="font-family:'Times New Roman',Times,serif,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size:16px">
</p>
<p><span style="font-size:12pt">**********</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt">From my printed var summary I cannot see anything wrong. </span></p>
<p><span style="font-size:12pt"><span style="font-family:'Times New Roman',Times,serif,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size:16px">**********</span><br>
</span></p>
<p><span style="font-size:12pt"></span></p>
<div>Variable: ET_1km</div>
<div>Type: float</div>
<div>Total Size: 4600 bytes</div>
<div> 1150 values</div>
<div>Number of Dimensions: 3</div>
<div>Dimensions and sizes: [time | 46] x [lat | 5] x [lon | 5]</div>
<div>Coordinates:</div>
<div> time: [001..361]</div>
<div> lat: [30.62..34.4]</div>
<div> lon: [-112.5..-107.5]</div>
<div>Number Of Attributes: 5</div>
<div> long_name : MOD16A2 -- MODIS Gridded 1KM 8-day Composite Evapotranspiration (ET)</div>
<div> units : km/m^2/8day or 5day6day</div>
<div> missing_value : 32767</div>
<div> remap : remapped via ESMF_regrid_with_weights: Bilinear</div>
<div> _FillValue : 32767</div>
<div><span style="font-family:'Times New Roman',Times,serif,'Apple Color Emoji','Segoe UI Emoji',NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size:16px">**********</span><br>
</div>
<br>
<p></p>
<p><span style="font-size:12pt">Could someone help? Thank you very much, </span></p>
<p><span style="font-size:12pt">Yaoping Wang</span><br>
</p>
</div>
<p></p>
</div>
</div>
</div>
</div>
</body>
</html>