Re: IDL and GRIB [message #94036 is a reply to message #94025] |
Thu, 29 December 2016 17:30   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
On Tuesday, 27 December 2016 06:57:08 UTC-8, s.fd...@gmail.com wrote:
> Dear all,
>
> I'm trying to run the following IDL code:
>
> --------------
> pro read_grb2
>
> file = FILEPATH('atl.grb2', $
> SUBDIRECTORY=['examples','data'])
> ;FILE_COPY,file,dir+'atl.grb2'
> GRIB_LIST,dir+'atl.grb2'
>
> record = ORDEREDHASH()
> record['GRIBEditionNumber']=2
> record['values'] = dblarr(1024)
> GRIB_PUTDATA, dir+file, record
>
> end
> --------------------------
>
> It should add "record" to the grib file atl.grb2 (that was copied in my home directory).
> When I run the code I get the following error:
>
> % Loaded DLM: GRIB.
> % Compiled module: GRIB_LIST.
> 1 crain DOUBLEARRAY[141151]
> 2 usct DOUBLEARRAY[141151]
> 3 vsct DOUBLEARRAY[141151]
> 4 tsec DOUBLEARRAY[141151]
> % Compiled module: GRIB_PUTDATA.
> % GRIB_PUTDATA: GRIB_SET: Value is read only
> % Execution halted at: READ_GRB2 123
> /Users/stefano/fdgrib2/read_grb2.pro
> % $MAIN$
>
> I cannot understand the reason for this error. Does anybody have an idea?
>
> Thanks
>
> Stefano
Hi Stefano,
I'm guessing that the code you ran is not *exactly* what you quoted, because 'dir' doesn't seem to be given a value before it is used. In any case, if GRIB_LIST worked with dir+'atl.grb2', and if you are getting 'file' from FILEPATH(), which returns a fully-qualified path, you would be calling GRIB_PUTDATA with a filename of something like /path/to/examples/data//path/to/examples/data/atl.grb2, which I will guess does not exist.
The "Value is read only" message doesn't really point to this sort of problem, but you never can tell with error messages… Is that in fact the problem?
Cheers,
-Dick
Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
|
|
|