Re: message warning check_for_y_lat_coord

From: Noelia otero <noeli1680_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 07 2014 - 12:53:08 MDT

Hi,

Thanks, yes I know that it might be a problem with the arrays and actually
I realized of one error in the lat dimension but afterwards the problem is
the same:
this is my try again:

       pr =a->pr
       wami =b->WAMI(:,0,0,0)

        printVarSummary(pr)
        pr!0="time" ; assign attributes
        pr!1="lat"
        pr!2="lon"
        wami!0="time"
        prT = transpose(pr) ; need to transpose to get the correlations
        prT!0="lon" ; assign attributes
        prT!1="lat"
        prT!2="time"
        printVarSummary(prT)
        ;copy_VarCoords(prT,correl) ; copy attributes from temp to pcp

        correl=escorc(wami,prT(lon|:,lat|:,time|:))
        correl!0="lon"
        lon@long_name="longitude"
        lon@units="degrees_east"
        correl&lon=lon
        correl!1="lat"
        lat@long_name="latitude"
        lat@units="degrees_north"
        correl&lat=lat

the print messages are:
printVarSummary (pr)

Type: float
Total Size: 90720 bytes
            22680 values
Number of Dimensions: 3
Dimensions and sizes: [time | 45] x [lat | 18] x [lon | 28]
Coordinates:
            time: [40800..56871]
            lat: [37.67308962904533..-9.767145559195573]
            lon: [-28.125..47.8125]
Number Of Attributes: 9
  standard_name : precipitation_flux
  long_name : Precipitation
  units : kg m-2 s-1
  grid_type : gaussian
  _FillValue : 1e+20
  comment : at surface; includes both liquid and solid phases from all
types of clouds (both large-scale and convective)
  original_name : PRECC+PRECL
  cell_methods : time: mean (interval: 20 mintues)
  associated_files : baseURL:
http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile:
gridspec_atmos_fx_bcc-csm1-1_historical_r0i0p0.nc areacella:
areacella_fx_bcc-csm1-1_historical_r0i0p0.nc


I don't know where the problem is, I tried to repeat it for several times
but I always have the same error about the coordinates... and the
coordinates seem correct to me in the correl variable..I though that the
problem could be in the transposition of pr, but that is neccesary, since
the dimensions have to be changed for the correlation, ( The last dimension
of x must be equal to the last dimension of y).

I really apreciate your help.

Thanks!

Cheers,

Noelia





2014-07-07 17:52 GMT+02:00 Mary Haley <haley@ucar.edu>:

> Hi,
>
> I think you are almost there. The confusion seems to be with how to
> reorder the various arrays.
>
> First, are you sure "pr" is dimensioned time x lon x lat? I'm asking,
> because this part seems wrong to me:
>
> pr!0="time" ; assign attributes
> pr!1="lon"
> pr!2="lat"
>
> Normally, it would be:
>
> pr!0="time" ; assign attributes
> pr!1="lat"
> pr!2="lon"
>
> But, are you sure you even need to do those assignments? When you read
> "pr" off the file, it may already have named dimensions, and hence you
> shouldn't have to do this yourself.
>
> Right after this line:
>
> pr =a->pr
>
> please add this line, and tell me what it reports:
>
> printVarSummary(pr)
>
>
> Moving further down in your code, before you call escorc, you are
> reordering the array to lon x lat x time, but I think you want lat x lon x
> time:
>
> correl=escorc(wami,prT(lat|:,lon|:,time|:))
>
> Your "correl" array should now be dimensioned lat x lon, which is the
> correct order for plotting.
>
> The rest of your code, then, is mostly correct. You want to be sure to set
> up the "lat" and "lon" arrays with the correct names and units *before* you
> assign them with the "&" operator:
>
> lon@long_name="longitude"
> lon@units="degrees_east"
> lat@long_name="latitude"
> lat@units="degrees_north"
> correl!0="lon"
> correl!1="lat"
> correl&lon=lon
> correl&lat=lat
>
> --Mary
>
>
> On Sat, Jul 5, 2014 at 9:25 AM, Noelia otero <noeli1680@gmail.com> wrote:
>
>> Hi,
>>
>> Thanks for your suggestions. Unfortunately I still have the same problem
>> with the coordinates and the code is not working....I can't figure out
>> why.
>> I think that it might be a problem with the coordinates in the correl:
>>
>> a =
>> addfile("/home/nof/pruebas/ensem_means/pr_Amon_bcc-csm1-1_historical_ensmean_t42_westA_meanJAS.nc","r")
>> b =
>> addfile("/home/nof/pruebas/WAMI_CEOF/WAMI_Amon_bcc-csm1-1_historical_ensmean.nc","r")
>>
>>
>> pr =a->pr
>> wami =b->WAMI(:,0,0,0)
>> lat = a->lat
>> lon = a->lon
>> ;*****Transpose the dimension to get the correlations
>> prT = transpose(pr)
>> prT!0="lon" ; assign attributes
>> prT!1="lat"
>> prT!2="time"
>> ;copy_VarCoords(prT,correl) ; copy attributes from temp to pcp
>>
>> correl=escorc(wami,prT(lon|:,lat|:,time|:))
>> correl!0="lon"
>> lon@long_name="longitude"
>> lon@units="degrees_east"
>> correl&lon=lon
>> correl!1="lat"
>> lat@long_name="latitude"
>> lat@units="degrees_north"
>> correl&lat=lat
>> ;printVarSummary(correl)
>>
>> When I do printVarSummary(correl) the values seem to me correct, but if I
>> do:
>> printVarSummary(correl&lat)
>>
>> ;********
>> Variable: lat (coordinate)
>> Type: double
>> Total Size: 144 bytes
>> 18 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [lat | 18]
>> Coordinates:
>> Number Of Attributes: 4
>> axis : Y
>> units : degrees_north
>> long_name : latitude
>> standard_name : latitude
>>
>> Could it be the problem here? Any idea??
>> Thanks again,
>>
>> Cheers,
>>
>> Noelia
>>
>>
>>
>> 2014-07-04 8:22 GMT+02:00 Mahesh Varma <mkmvarma@gmail.com>:
>>
>> I think left most dimension of correl should be lat. Try correl(lat |:,
>>> lon|:) in the plotting statement.
>>> On Jul 3, 2014 11:08 PM, "Noelia otero" <noeli1680@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am looking for some support to fix the next problem. I have already
>>>> read some posts concerning this message, but so far, I did not solve this
>>>> (I am start learning the language).
>>>>
>>>> after running the script, this is the message:
>>>>
>>>>
>>>> Variable: correl
>>>> Type: float
>>>> Total Size: 2016 bytes
>>>> 504 values
>>>> Number of Dimensions: 2
>>>> Dimensions and sizes: [lon | 18] x [lat | 28]
>>>> Coordinates:
>>>> lon: [37.67308962904533..-9.767145559195573]
>>>> lat: [-28.125..47.8125]
>>>> Number Of Attributes: 1
>>>> _FillValue : 1e+20
>>>> (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'
>>>>
>>>> And this is the 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"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>>
>>>> ;*******************************************************************************
>>>> begin
>>>>
>>>> a =
>>>> addfile("/home/nof/pruebas/ensem_means/pr_Amon_bcc-csm1-1_historical_ensmean_t42_westA_meanJAS.nc","r")
>>>> b =
>>>> addfile("/home/nof/pruebas/WAMI_CEOF/WAMI_Amon_bcc-csm1-1_historical_ensmean.nc","r")
>>>>
>>>>
>>>> pr =a->pr
>>>> wami =b->WAMI(:,0,0,0)
>>>> lat = a->lat
>>>> lon = a->lon
>>>>
>>>> pr!0="time" ; assign attributes
>>>> pr!1="lon"
>>>> pr!2="lat"
>>>> wami!0="time"
>>>> ;pr&lat=lat
>>>> ;pr&lon=lon
>>>> prT = transpose(pr)
>>>> copy_VarCoords(pr,wami) ; copy attributes from temp to pcp
>>>> correl=escorc(wami,prT(lon|:,lat|:,time|:))
>>>> correl!1="lat"
>>>> correl!0="lon"
>>>> correl&lat=pr&lat
>>>> correl&lon=pr&lon
>>>> correl&lat@units = "degrees_north"
>>>> correl&lon@units = "degrees_east"
>>>> printVarSummary(correl)
>>>> wks = gsn_open_wks("x11","example")
>>>> plot = gsn_csm_contour_map_ce(wks,correl,False)
>>>>
>>>> end
>>>>
>>>> I don't understand the message very much,because looking into the
>>>> variables and dimensions, the names seem correct to me, so I don't know
>>>> where the problem is...what am I missing?
>>>> Thanks a lot in advance!
>>>>
>>>> Cheers,
>>>>
>>>> Noelia
>>>>
>>>> _______________________________________________
>>>> 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 Jul 07 06:53:10 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:47 MDT