Re: Rank correlation

From: Alessandra Giannini <alesall_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 06 2013 - 18:42:19 MDT

Hi Guilherme,

assuming the lon, lat dimensions are the same for your two arrays that you want to correlate in time,
you added the units descriptor, which should have taken care of this type of error message:

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'

but you have not specified values for lat and lon, which would take care of the other type of error:

check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.

To get rid of that error, try adding lines such as:

spc&lat = lat
spc&lon = lon

where lat and lon come from your files. So, in fact you would need to first read the lat and lon arrays, and then define them as dimensions, so:

lat!0 = "lat"
lat&lat = lat

[My coding is super-antiquated. There should be a faster way to attach coordinates to variables, but I never learned it!]

Hope this helps!

best, alessandra

On Aug 6, 2013, at 7:51 PM, Guilherme Martins <jgmsantos@gmail.com> wrote:

> Hi all,
>
> I'm trying to calculate the rank correlation, but appear a error like below:
>
> (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'
>
> Then I put the:
>
> spc!0 = "lat"
> spc!1 = "lon"
> spc&lat@units = "degrees_north"
> spc&lon@units = "degrees_east"
>
> And the error continue, now appear:
>
> fatal:No coordinate variable exists for dimension (lat) in variable (spc)
> fatal:(lat) is not coordinate variable in variable(spc).
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 26 in file fig13.correlacao.ncl
>
> My code:
>
> 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"
>
> begin
>
> f1 = addfile("../modelo/mcga.prec.mensal.1986.2005.nc","r")
> f2 = addfile("../obs/prec/gpcp.mensal.1986.2005.nc","r")
>
> prp_mod = f1->prec ; nt,ny,nx --> dimensão 0,1,2
> prp_obs = f2->precip ; nt,ny,nx --> dimensão 0,1,2
>
> spc = spcorr_n(prp_mod,prp_obs,0) ; correlation at dimension time
>
> spc!0 = "lat"
> spc!1 = "lon"
> spc&lat@units = "degrees_north"
> spc&lon@units = "degrees_east"
>
> printVarSummary(spc)
>
> wks = gsn_open_wks("eps","corr")
>
> res = True
> res@cnFillOn = True
> res@cnLinesOn = False
> ;res@mpMinLonF = -160.
> ;res@mpMaxLonF = 0.
> ;res@mpMinLatF = -60.
> ;res@mpMaxLatF = 20.
>
> plot = gsn_csm_contour_map_ce(wks,spc,res)
>
> end
>
> Thanks,
>
> Guilherme
>
> --
> Guilherme Martins
> https://sites.google.com/site/jgmsantos/
>
> _______________________________________________
> 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 Tue Aug 6 18:42:33 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 07 2013 - 13:59:00 MDT