[ncl-talk] fatal:Dimension (lon) of (tprec) does not have an associated coordinate variable
Jayant
jayantkp2979 at gmail.com
Sun Apr 11 14:28:32 MDT 2021
Hi Adam,
I am reading time-lat-lon data from a binary file. Next, I create
coordinate variables based on the accompanying CTL file. The CTL file
indicates the binary to be sequential. I assign the coordinates to a
variable. But, I am getting an error. Below is a working example:
nlat=192
nlon=384
ntim=24
;
lon = lonGlobeF(nlon, "lon", "longitude", "degrees_east")
lat = latGau(nlat, "lat", "latitude", "degrees_north")
;
tim=new(ntim,integer)
tim!0 = "time"
tim at long_name = "time"
tim at units = "hours"
tim&time = tim
tim=0
;
tprec=new((/ntim,nlat,nlon/),float) ; surface variable
tprec!0="time"
tprec!1="lat"
tprec!2="lon"
tprec at time=tim
tprec at lat=lat
tprec at lon=lon
tprec at long_name="total precipitation"
tprec at units="kg m**-2 day**-1"
tprec=0.0
tprec=lonFlip(tprec)
;--- executing the above
ncl 29> print(tprec(16,{-5.0:-3.0},{-90:-85}))
fatal:Dimension (lon) of (tprec) does not have an associated coordinate
variable
fatal:["Execute.c":7741]:Execute: Error occurred at or near line 29
;
ncl 30> print(tprec(16,{-5.0:-3.0},:))
fatal:Dimension (lat) of (tprec) does not have an associated coordinate
variable
fatal:["Execute.c":7741]:Execute: Error occurred at or near line 30
;
ncl 31> printVarSummary(tprec)
Variable: tprec
Type: float
Total Size: 7077888 bytes
1769472 values
Number of Dimensions: 3
Dimensions and sizes: [time | 24] x [lat | 192] x [lon | 384]
Coordinates:
Number Of Attributes: 7
lonFlip : longitude coordinate variable has been reordered via lonFlip
time : <ARRAY of 24 elements>
lat : <ARRAY of 192 elements>
lon : <ARRAY of 384 elements>
long_name : total precipitation
units : kg m**-2 day**-1
_FillValue : 9.96921e+36
ncl 32> print(isdimnamed(prec,ispan(0,2,1)))
True
True
True
;
ncl 33> if(all(iscoord(tprec,(/"time","lat","lon"/)))) then
print("min/max tprec&lat = " + min(tprec&lat) + "/" + max(tprec&lat))
print("min/max tprec&lon = " + min(tprec&lon) + "/" + max(tprec&lon))
end if
ncl 34>
What am I missing?
Also, the warnings (below) that appears when plotting (ignoring the print
statements) related to the above issue with coordinate variables?
(0) check_for_y_lat_coord: Warning: Data either does not contain a valid
latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units' attribute equal
to one of the following values:
(0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0) check_for_lon_coord: Warning: Data either does not contain a valid
longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
Best,
Jayant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210411/f9d9e2f0/attachment-0001.html>
More information about the ncl-talk
mailing list