[ncl-talk] Error outputting data to NetCDF file

Rick Brownrigg brownrig at ucar.edu
Mon Jun 19 09:20:55 MDT 2017


Hi,

Are there any other error messages printed -- that one is rather vague.  I
don't know the issue for certain, but since the variable "event" was
created using the ispan() function, I don't see where it would have a named
dimension, and thus the function call getvardims(event) may be returning a
missing value.

Rick

On Mon, Jun 19, 2017 at 8:38 AM, Tess Parker <tess.parker at monash.edu> wrote:

> Hi -
>
> I am trying to write some variables to a netcdf file. The attached script
> returns an error message:
>
> *fatal:["Execute.c":8578]:*
> *Execute: Error occurred at or near line 272 in file test.ncl*
> Basically, I have a list of 41 target dates (*init_date*). 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 *fcast_time*), do the
> calculations, and store the sf and vp values to new variables (*usf_arr,
> vsf_arr, uvp_arr, vvp_arr*) which are dimensioned 41 x 61 x lat x lon.
> The *event* and *fcast_time* coordinate variables are integer type, and
> monotonically increasing.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *Variable: usf_arrType: floatTotal Size: 1311244288 bytes
> 327811072 valuesNumber of Dimensions: 4Dimensions and sizes:    [event |
> 41] x [fcast_time | 61] x [lat | 256] x [lon | 512]Coordinates:
> event: [0..40]            fcast_time: [0..360]            lat:
> [-89.46294..89.46294]            lon: [ 0..359.2969]Number Of Attributes:
> 1  _FillValue :    9.96921e+36*
>
> 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.
>
> 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....
>
>
> ***************************************
> if (dofile) then
>
>    nevent = 41
>    ntime  = 61
>    nlat   = latdims
>    nlon   = londims
>
>    setfileoption("nc","Format","NetCDF4Classic")
>
>    outfile = "U_V_divergence_250_2006_2015.nc"
>
>    system("rm -f "+outfile)
>
>    ncdf = addfile(outfile, "c")
>
>     setfileoption(ncdf,"DefineMode",True)
>
>     fAtt               = True            ; assign file attributes
>     fAtt at creation_date = systemfunc ("date")
>     fileattdef( ncdf, fAtt )            ; copy file attributes
>
>    dimNames    = (/"event","fcast_time","lat","lon"/)
>    dimSizes    = (/nevent,ntime,nlat,nlon/)
>    dimUnlim    = (/False,False,False,False/)
>    filedimdef(ncdf,dimNames,dimSizes,dimUnlim)
>
>   * filevardef(ncdf,"event",typeof(event),getvardims(event))*
>    filevardef(ncdf,"fcast_time",typeof(fcast_time),getvardims(fcast_time))
>    filevardef(ncdf,"lat",typeof(lat),getvardims(lat))
>    filevardef(ncdf,"lon",typeof(lon),getvardims(lon))
>    filevardef(ncdf,"usf_arr",typeof(usf_arr),getvardims(usf_arr))
>    filevardef(ncdf,"vsf_arr",typeof(vsf_arr),getvardims(vsf_arr))
>    filevardef(ncdf,"uvp_arr",typeof(uvp_arr),getvardims(uvp_arr))
>    filevardef(ncdf,"vvp_arr",typeof(vvp_arr),getvardims(vvp_arr))
>
>    filevarattdef(ncdf,"usf_arr",usf_arr)
>    filevarattdef(ncdf,"event",event)
>    filevarattdef(ncdf,"fcast_time",fcast_time)
>    filevarattdef(ncdf,"lat",lat)
>    filevarattdef(ncdf,"lon",lon)
>    filevarattdef(ncdf,"vsf_arr",vsf_arr)
>    filevarattdef(ncdf,"uvp_arr",uvp_arr)
>    filevarattdef(ncdf,"vvp_arr",vvp_arr)
>
>   setfileoption(ncdf,"DefineMode",False)
>
>    ncdf->event           = (/event/)
>    ncdf->fcast_time      = (/fcast_time/)
>    ncdf->lat            = (/lat/)
>    ncdf->lon            = (/lon/)
>    ncdf->usf_arr        = (/usf_arr/)
>    ncdf->vsf_arr        = (/vsf_arr/)
>    ncdf->uvp_arr        = (/uvp_arr/)
>    ncdf->vvp_arr        = (/vvp_arr/)
>
> end if
>
>
> --
> Tess Parker
> Associate Researcher
> School of Earth, Atmosphere and Environment
> Room 225, Building 28
> 9 Rainforest Walk
> Monash University, Clayton VIC 3800
>
> http://users.monash.edu.au/~tess/index.html
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170619/5a568ab6/attachment.html 


More information about the ncl-talk mailing list