[ncl-talk] setfileoption

Takeshi Enomoto takeshi at macports.org
Fri Dec 9 21:42:27 MST 2016


Hi,

I haven’t been posted for a long time, but I regularly use NCL.
I appreciate the efforts of development and support.

A user of ncarg of MacPorts reported a problem with ESMF.
The error appears to be cause with MacPorts’ ncl, not with the binary at UCAR.

<https://trac.macports.org/ticket/53031>

I investigated the script and found that setfileoption() wipes the symbol table:
after a call to setfileoption variables become undefined.

I appreciate any suggestions for fixing the problem.

Regards,

T.

$ cat bar.ncl
procedure curvilinear_to_SCRIP(Opt[1]:logical)
begin
    if (isatt(Opt,"NetCDFType").and.\
        str_lower(Opt at NetCDFType).eq."netcdf4") then
      setfileoption("nc","Format","netcdf4")
      nc_file_type = "netcdf4"
    else
      nc_file_type = "netcdf3"
    end if
    print(nc_file_type)
end     ; of curvilinear_to_SCRIP(...)
begin
  Opt = True
  curvilinear_to_SCRIP(Opt)
  Opt at NetCDFType = "netcdf4"
  curvilinear_to_SCRIP(Opt)
  Opt at NetCDFType = "netcdf3"
  curvilinear_to_SCRIP(Opt)
end

$ ncl -nQ bar.ncl 


Variable: nc_file_type
Type: string
Total Size: 8 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:	[1]
Coordinates: 
netcdf3
fatal:Variable (nc_file_type) is undefined
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 10 in file bar.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 16 in file bar.ncl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161210/dbb6ce2e/attachment.html 


More information about the ncl-talk mailing list