Re: check_for_y_lat_coord Error

From: Jessica Mackaro <jmackaro_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 28 2010 - 15:04:45 MDT

Ibo,

The error message says the units are not correct for plotting.

The plot function

    plot = gsn_csm_contour_map_ce(wks,c,res)

requires that the variable being plotted ("c") have associated
coordinate variables. These coordinate variables [lat & lon]
must have units such as "degrees_north" and "degrees_east"
You should have noted that

  printVarSummary(c)

does not contain any coordinate information.

Debasish was close ... Please try:

  c!0="lat" ; name dimensions
  c!1="lon"
  c&lat = x1&lat ; assign coordinate values and
  c&lon = x1&lon ; units attributes

  plot = gsn_csm_contour_map_ce(wks,c,res)

Jessica

On 04/28/2010 02:55 PM, Ibo Ze wrote:
> Hi Debasish,
>
> By adding the lines as suggested, following error appear:
>
> fatal:No coordinate variable exists for dimension (lat) in variable (c)
> fatal:(lat) is not coordinate variable in variable(c).
>
> fatal:No coordinate variable exists for dimension (lon) in variable (c)
> fatal:(lon) is not coordinate variable in variable(c).
>
> any thoughts how to handle this?
>
> Thanks,
> Ibo
> ------------------------------------------------------------------------
> *From:* Debasish PaiMazumder <debasish@sca.uqam.ca>
> *To:* Ibo Ze <ibo85@ymail.com>
> *Cc:* Ncl Talk <ncl-talk@ucar.edu>
> *Sent:* Wed, April 28, 2010 3:25:54 PM
> *Subject:* Re: [ncl-talk] check_for_y_lat_coord Error
>
> Hello,
>
> Try to add the followings after calculation of correlation
>
> c!0="lat"
> c!1="lon"
> c&lat@units="degrees_north"
> c&lon@units="degrees_east"
>
> Thanks
>
> Debasish
>
>
> On 10-04-28, at 15:12, Ibo Ze wrote:
>
>> Hi,
>>
>> I want to calculate cross-correlation at 0 lag. Getting following error:
>>
>> (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'
>>
>> Script below addressed this issue as described in mini graphics manual
>> but error still persists. Kindly help to rectify this.
>> Thanks.
>>
>> *Header of file1 is as follow:*
>>
>> netcdf 6104_pksec_06 {
>> dimensions:
>> time = 44 ;
>> lat = 120 ;
>> lon = 260 ;
>>
>> variables:
>> float a(time, lat, lon) ;
>> a:_FillValue = -999.f ;
>> double lat(lat) ;
>> lat:long_name = "Latitude" ;
>> lat:units = "degrees_north" ;
>> double lon(lon) ;
>> lon:long_name = "Longitude" ;
>> lon:units = "degrees_east" ;
>> float time(time) ;
>> time:units = "months since 1961-01-01" ;
>>
>> *Header of file 2 is as follow:*
>>
>> netcdf 6104_pk_june_avg {
>> dimensions:
>> time = 44 ;
>>
>> variables:
>> float a(time) ;
>> a:_FillValue = -999.f ;
>> double lat ;
>> lat:long_name = "Latitude" ;
>> lat:units = "degrees_north" ;
>> double lon ;
>> lon:long_name = "Longitude" ;
>> lon:units = "degrees_east" ;
>> float time(time) ;
>> time:units = "months since 1961-01-01" ;
>>
>>
>> *and the script for calculation 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"
>>
>> ;**********************************************
>> ; Reading Data and correlation function
>> ;**********************************************
>> f1 = addfile("6104_pksec_06.nc <http://6104_pksec_06.nc>","r")
>> f2 = addfile("6104_pk_june_avg.nc <http://6104_pk_june_avg.nc>","r")
>> x1 = f1->a(lat|:,lon|:,time|:)
>> x2 = f2->a
>> x1!0="lat"
>> x1!1="lon"
>> x1&lat@units="degrees_north"
>> x1&lon@units="degrees_east"
>> c = escorc(x2,x1)
>> printVarSummary(c)
>>
>> ;**********************************************
>> ; Invoke resources and set limits
>> ;*********************************************
>> wks = gsn_open_wks ("x11","pksec_pk_06") ; open ps file
>>
>> gsn_define_colormap(wks,"radar")
>> res = True
>> res@gsnDraw = False
>> res@cnFillOn = True
>> res@cnLinesOn = False
>>
>> ;*******************************************************
>> ; create map resources with focus on domain
>> ;*******************************************************
>>
>> res@mpOutlineBoundarySets = "AllBoundaries"
>> res@mpDataBaseVersion = "MediumRes"
>> res@mpDataSetName = "Earth..3"
>> res@mpOutlineOn = True
>> res@mpFillOn = False
>> res@mpMaxLatF = 35
>> res@mpMinLatF = 5
>> res@mpMaxLonF = 125
>> res@mpMinLonF = 60
>>
>> res@cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
>> res@cnMinLevelValF = -1. ; min level
>> res@cnMaxLevelValF = 1. ; max level
>> res@cnLevelSpacingF = .22 ; contour level spacing
>> res@tiMainFontHeightF = 0.03
>> res@gsnAddCyclic = False
>> plot = gsn_csm_contour_map_ce(wks,c,res)
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> Debasish PaiMazumder, PhD
> Postdoctoral Researcher
> Analysis and Simulation of Regional-Scale Climate
> Department of Earth and Atmospheric Sciences
> University of Québec at Montréal (UQÀM)
> 550, Sherbrooke west, 19th floor, west tower,
> Montréal, QC, Canada H3A 1B9
> Tel: (514) 282-6464-343
> (514) 937-0042 (R)
> email: debasish@sca.uqam.ca <mailto:debasish@sca.uqam.ca>
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
*********************************************************
                    Jessica N. Mackaro			
						
                 Climate Analysis Section			
          Climate and Global Dynamics Division		
        National Center for Atmospheric Research		
                      P.O. Box 3000			
                    Boulder, CO 80307 			
          tel: 303-497-1305   fax: 303-497-1333		
                email:jmackaro@ucar.edu       		
*********************************************************
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 28 15:05:12 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 29 2010 - 08:05:27 MDT