Re: Problem about "Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all"

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 17 2011 - 09:35:45 MDT

Hi Miao,

In order to overlay data on a map, you must either provide the exact map projection that the data are measured on,
or you must provide lat/lon coordinates of your data.

Since you have already read in 2D lat/lon coordinates, you can provide them to the NCL plotting routine by using sfXArray and sfYArray resources:

   res@sfXArray = lon2d
   res@sfYArray = lat2d

Since this is regional data, you'll also want to make sure a longitude cyclic point is not added by setting:

  res@gsnAddCyclic = False

Finally, it is not necessary to subscript arrays with "(:,:)". Just use the variable name, and you will get all the data values:

    lat2d = inposatm ->xlat
     lon2d = inposatm ->xlon

. . .

    plot = gsn_csm_contour_map(wks,temp1,res)

--Mary

On Oct 17, 2011, at 8:59 AM, Miao Yu wrote:

> Dear All,
>
> I’m trying to analyses the results from RegCM4.1.1 modeling results using NCL6.0.0.
>
> The NCL script is as follows.
> ;************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
>
> inposatm = addfile("WAfr_ATM.1990010100.nc","r")
>
> lat2d = inposatm ->xlat(:,:)
> lon2d = inposatm ->xlon(:,:)
>
> temp1 = inposatm ->t(0,10,:,:)
>
> ; Get dimensions from variable
> dimvar = dimsizes(ps1)
> jlat = dimvar(0)
> ilon = dimvar(1)
>
> ; create plot
>
> wks = gsn_open_wks("pdf","WAfr_199001")
>
> res = True
> res@mpLimitMode = "Corners" ; choose range of map
> res@mpLeftCornerLatF = lat2d(0,0)
> res@mpLeftCornerLonF = lon2d(0,0)
> res@mpRightCornerLatF = lat2d(jlat-1,ilon-1)
> res@mpRightCornerLonF = lon2d(jlat-1,ilon-1)
> res@mpProjection = "Mercator" ; choose projection
> res@mpCenterLatF = 8.0
> res@mpCenterLonF = 0.0
> res@mpGridAndLimbOn = True
>
> plot = gsn_csm_contour_map(wks,temp1(:,:),res)
>
> end
> ;************************************************
>
> It gives me these warnings when running this script.
>
> (0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contai
> n 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' 'degre
> eN' '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'
>
> I checked the information of the variable temp1.
> Variable: temp1
> Type: float
> Total Size: 84992 bytes
> 21248 values
> Number of Dimensions: 2
> Dimensions and sizes: [iy | 128] x [jx | 166]
> Coordinates:
> iy: [-3175..3175]
> jx: [-4125..4125]
> Number Of Attributes: 6
> time : 8766
> standard_name : air_temperature
> long_name : Temperature
> units : K
> coordinates : xlat xlon
> grid_mapping : rcm_map
>
> I’ve tried to change its coordinate attributes, but failed to solve this problem. Besides, the variable temp1 is straightly from the RegCM4.1.1 output, and has the specific coordinate array. I feel more confused about this. Why did these warnings come out? Please give me some suggestions.
>
> Thank you very much.
>
> Miao
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 17 09:35:54 2011

This archive was generated by hypermail 2.1.8 : Tue Oct 18 2011 - 09:42:15 MDT