<div dir="ltr"><div>Hi -<br><br></div>I am trying to write some variables to a netcdf file. The attached script returns an error message:<br><br><div><div><div><i>fatal:["Execute.c":8578]:</i><wbr><i>Execute: Error occurred at or near line 272 in file test.ncl<br></i><br></div><div>Basically, I have a list of 41 target dates (<i>init_date</i>). I read in the u250 and v250 data for each of these target dates and the 10 days thereafter (for 61 x 6-hrly timesteps, or <i>fcast_time</i>), do the calculations, and store the sf and vp values to new variables (<i>usf_arr, vsf_arr, uvp_arr, vvp_arr</i>) which are dimensioned 41 x 61 x lat x lon. The <i>event</i> and <i>fcast_time</i> coordinate variables are integer type, and monotonically increasing.<br><br><i>Variable: usf_arr<br>Type: float<br>Total Size: 1311244288 bytes<br> 327811072 values<br>Number of Dimensions: 4<br>Dimensions and sizes: [event | 41] x [fcast_time | 61] x [lat | 256] x [lon | 512]<br>Coordinates: <br> event: [0..40]<br> fcast_time: [0..360]<br> lat: [-89.46294..89.46294]<br> lon: [ 0..359.2969]<br>Number Of Attributes: 1<br> _FillValue : 9.96921e+36<br></i><br><br></div><div>I then try to write out the new variables to a netcdf file using the file predefintion method. The error occurs at the line in bold type: the first filevardef call.<br><br></div><div>I've tried a number of things but no luck. Any suggestions? Only thing I could think of is perhaps the lack of a specific date attribute, but I don't need that, just the 41 target dates with their sets of 61 timesteps....<br><br></div><div><br>***************************************<br>if (dofile) then<br><br> nevent = 41<br> ntime = 61<br> nlat = latdims<br> nlon = londims<br><br> setfileoption("nc","Format","NetCDF4Classic")<br><br> outfile = "U_V_divergence_250_2006_2015.nc" <br><br> system("rm -f "+outfile)<br><br> ncdf = addfile(outfile, "c")<br><br> setfileoption(ncdf,"DefineMode",True)<br><br> fAtt = True ; assign file attributes<br> fAtt@creation_date = systemfunc ("date") <br> fileattdef( ncdf, fAtt ) ; copy file attributes <br><br> dimNames = (/"event","fcast_time","lat","lon"/) <br> dimSizes = (/nevent,ntime,nlat,nlon/)<br> dimUnlim = (/False,False,False,False/)<br> filedimdef(ncdf,dimNames,dimSizes,dimUnlim)<br><br> <b> filevardef(ncdf,"event",typeof(event),getvardims(event))</b><br> filevardef(ncdf,"fcast_time",typeof(fcast_time),getvardims(fcast_time))<br> filevardef(ncdf,"lat",typeof(lat),getvardims(lat))<br> filevardef(ncdf,"lon",typeof(lon),getvardims(lon))<br> filevardef(ncdf,"usf_arr",typeof(usf_arr),getvardims(usf_arr))<br> filevardef(ncdf,"vsf_arr",typeof(vsf_arr),getvardims(vsf_arr))<br> filevardef(ncdf,"uvp_arr",typeof(uvp_arr),getvardims(uvp_arr))<br> filevardef(ncdf,"vvp_arr",typeof(vvp_arr),getvardims(vvp_arr))<br><br> filevarattdef(ncdf,"usf_arr",usf_arr)<br> filevarattdef(ncdf,"event",event)<br> filevarattdef(ncdf,"fcast_time",fcast_time)<br> filevarattdef(ncdf,"lat",lat)<br> filevarattdef(ncdf,"lon",lon)<br> filevarattdef(ncdf,"vsf_arr",vsf_arr)<br> filevarattdef(ncdf,"uvp_arr",uvp_arr)<br> filevarattdef(ncdf,"vvp_arr",vvp_arr)<br> <br> setfileoption(ncdf,"DefineMode",False)<br><br> ncdf->event = (/event/)<br> ncdf->fcast_time = (/fcast_time/)<br> ncdf->lat = (/lat/)<br> ncdf->lon = (/lon/)<br> ncdf->usf_arr = (/usf_arr/)<br> ncdf->vsf_arr = (/vsf_arr/)<br> ncdf->uvp_arr = (/uvp_arr/)<br> ncdf->vvp_arr = (/vvp_arr/)<br><br>end if<br><br></div><div><br clear="all"><div><div class="gmail-m_-5406591978742435497gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>-- <br>Tess Parker<br>Associate Researcher<br>School of Earth, Atmosphere and Environment<br>Room 225, Building 28<br></div><div>9 Rainforest Walk<br></div><div>Monash University, Clayton VIC 3800<br><br></div><a href="http://users.monash.edu.au/%7Etess/index.html" target="_blank">http://users.monash.edu.au/~<wbr>tess/index.html</a><br></div></div></div></div></div></div></div>
</div></div></div></div>