<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:[&quot;Execute.c&quot;: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&#39;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&#39;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(&quot;nc&quot;,&quot;Format&quot;,&quot;NetCDF4Classic&quot;)<br><br>   outfile = &quot;U_V_divergence_250_2006_2015.nc&quot; <br><br>   system(&quot;rm -f &quot;+outfile)<br><br>   ncdf = addfile(outfile, &quot;c&quot;)<br><br>    setfileoption(ncdf,&quot;DefineMode&quot;,True)<br><br>    fAtt               = True            ; assign file attributes<br>    fAtt@creation_date = systemfunc (&quot;date&quot;)        <br>    fileattdef( ncdf, fAtt )            ; copy file attributes    <br><br>   dimNames    = (/&quot;event&quot;,&quot;fcast_time&quot;,&quot;lat&quot;,&quot;lon&quot;/)  <br>   dimSizes    = (/nevent,ntime,nlat,nlon/)<br>   dimUnlim    = (/False,False,False,False/)<br>   filedimdef(ncdf,dimNames,dimSizes,dimUnlim)<br><br>  <b> filevardef(ncdf,&quot;event&quot;,typeof(event),getvardims(event))</b><br>   filevardef(ncdf,&quot;fcast_time&quot;,typeof(fcast_time),getvardims(fcast_time))<br>   filevardef(ncdf,&quot;lat&quot;,typeof(lat),getvardims(lat))<br>   filevardef(ncdf,&quot;lon&quot;,typeof(lon),getvardims(lon))<br>   filevardef(ncdf,&quot;usf_arr&quot;,typeof(usf_arr),getvardims(usf_arr))<br>   filevardef(ncdf,&quot;vsf_arr&quot;,typeof(vsf_arr),getvardims(vsf_arr))<br>   filevardef(ncdf,&quot;uvp_arr&quot;,typeof(uvp_arr),getvardims(uvp_arr))<br>   filevardef(ncdf,&quot;vvp_arr&quot;,typeof(vvp_arr),getvardims(vvp_arr))<br><br>   filevarattdef(ncdf,&quot;usf_arr&quot;,usf_arr)<br>   filevarattdef(ncdf,&quot;event&quot;,event)<br>   filevarattdef(ncdf,&quot;fcast_time&quot;,fcast_time)<br>   filevarattdef(ncdf,&quot;lat&quot;,lat)<br>   filevarattdef(ncdf,&quot;lon&quot;,lon)<br>   filevarattdef(ncdf,&quot;vsf_arr&quot;,vsf_arr)<br>   filevarattdef(ncdf,&quot;uvp_arr&quot;,uvp_arr)<br>   filevarattdef(ncdf,&quot;vvp_arr&quot;,vvp_arr)<br>    <br>  setfileoption(ncdf,&quot;DefineMode&quot;,False)<br><br>   ncdf-&gt;event           = (/event/)<br>   ncdf-&gt;fcast_time      = (/fcast_time/)<br>   ncdf-&gt;lat            = (/lat/)<br>   ncdf-&gt;lon            = (/lon/)<br>   ncdf-&gt;usf_arr        = (/usf_arr/)<br>   ncdf-&gt;vsf_arr        = (/vsf_arr/)<br>   ncdf-&gt;uvp_arr        = (/uvp_arr/)<br>   ncdf-&gt;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>