Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Confirmed.

Page info
infoTypeModified date
prefixLast modified on
typeFlat

Problem

You downloaded data from the ECMWF data server or another ECMWF repository in NetCDF format.

Then you are trying to read the data with the NCAR Command Language (NCL) , GrADS or Ferret, but get an error message, for example for NCL:

Info
iconfalse
ncl 0> f = addfile("ECMWF-data.nc","r")
ncl 1> print (getfilevarnames (f))     
(0)     longitude
(1)     latitude
(2)     time
(3)     p83.162
(4)     p86.162
 q
ncl 3> x = f->p83.162  
fatal:syntax error: line 3 before or near .162
x = f->p83.162
-------------^
ncl 4> x = f->"p83.162"  
fatal:syntax error: line 4 before or near >
x = f->
------^

Cause

NCL, GrADS and Ferret do not support dots in variable names.

Solution for NCL

Enclose the variable name in double quotes and Dollar signs:

Info
iconfalse
ncl 0> f = addfile("ECMWF-data.nc","r")
ncl 1> print (getfilevarnames (f))     
(0)     longitude
(1)     latitude
(2)     time
(3)     p83.162
(4)     p86.162
 q
ncl 2> x = f->$"p83.162"$
ncl 3> print (x)
Variable: x
Type: short
Total Size: 7172160 bytes
            3586080 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 31] x [latitude | 241] x [longitude | 480]
Coordinates:
            time: [1024872..1025592]
            latitude: [90..-90]
            longitude: [ 0..359.25]
Number Of Attributes: 6
  scale_factor :        0.6170104064936749
  add_offset :  -3072.290927078247
  _FillValue :  -32767
  missing_value :       -32767
  units :       W m**-2
  long_name :   Vertical integral of divergence of thermal energy flux

Workaround

Rename the variable so the name contains only allowed character:

Content by Label
showLabelsfalse
max5
spacesCKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("cams","c3s","ecmwf","netcdf") and type = "page" and space = "CKB"
labelskb-troubleshooting-article