Re: question

From: Ibraheem Khan <khan18_at_nyahnyahspammersnyahnyah>
Date: Thu, 25 Jun 2009 16:18:13 -0500 (CDT)

Mary,

I noticed the same error meanwhile after sending you the results. And I tried then:

copy_VarCoords(x1(:,:,:),c)

but the output from:

copy_VarCoords(x1(:,:,0),c)

is same as above. "No Difference between two". Can you explain the reason?
Thanks

-Ibraheem

----- Original Message -----
From: "Mary Haley" <haley_at_ucar.edu>
To: "Ibraheem Khan" <khan18_at_atmos.uiuc.edu>
Cc: ncl-talk_at_ucar.edu
Sent: Thursday, June 25, 2009 4:04:22 PM GMT -06:00 US/Canada Central
Subject: Re: question

Ibraheem,

You need to pay attention to error messages:

  (0) ERROR: copy_VarCoords: dimension sizes do not match

I didn't notice this before, but you are trying to copy the "lon,
time" coordinates to an array that's dimensioned "lat, lon".

Change your copy_VarCoords call to:

       copy_VarCoords(x1(:,:,0),c)

This will access the "lat, lon" dimensions of x1.

--Mary

On Thu, 25 Jun 2009, Ibraheem Khan wrote:

> ncl -x point_corr.ncl (without begin and end gave following for the specified lines)
>
>
> + printVarSummary(x1)
>
>
> Variable: x1
> Type: float
> Total Size: 585728 bytes
> 146432 values
> Number of Dimensions: 3
> Dimensions and sizes: [lat | 52] x [lon | 64] x [time | 44]
> Coordinates:
> lat: [24.125..36.875]
> lon: [61.125..76.875]
> time: [ 0..516]
> Number Of Attributes: 1
> _FillValue : -999
> + c = escorc(x1(lat
> + printVarSummary(x1)
>
>
> Variable: x1
> Type: float
> Total Size: 585728 bytes
> 146432 values
> Number of Dimensions: 3
> Dimensions and sizes: [lat | 52] x [lon | 64] x [time | 44]
> Coordinates:
> lat: [24.125..36.875]
> lon: [61.125..76.875]
> time: [ 0..516]
> Number Of Attributes: 1
> _FillValue : -999
> + printVarSummary(x1(0,:,:))
>
>
> Variable: x1 (subsection)
> Type: float
> Total Size: 11264 bytes
> 2816 values
> Number of Dimensions: 2
> Dimensions and sizes: [lon | 64] x [time | 44]
> Coordinates:
> lon: [61.125..76.875]
> time: [ 0..516]
> Number Of Attributes: 2
> lat : 24.125
> _FillValue : -999
>
>
> + copy_VarCoords(x1(0,:,:),c)
> (0) ERROR: copy_VarCoords: dimension sizes do not match
>
>
> Variable: dto
> Type: integer
> Total Size: 8 bytes
> 2 values
> Number of Dimensions: 1
> Dimensions and sizes: [2]
> Coordinates:
> (0) 52
> (1) 64
>
>
> Variable: dfrom
> Type: integer
> Total Size: 8 bytes
> 2 values
> Number of Dimensions: 1
> Dimensions and sizes: [2]
> Coordinates:
> (0) 64
> (1) 44
> + ;copy_VarAtts(x1(:,:),c)
> + printVarSummary(c)
>
>
> Variable: c
> Type: float
> Total Size: 13312 bytes
> 3328 values
> Number of Dimensions: 2
> Dimensions and sizes: [52] x [64]
> Coordinates:
> Number Of Attributes: 1
> _FillValue : -999
>
>
>
> ncl -V:
>
> 5.1.1
>
>
> P.S. x1 is gridded dataset with x1(time,lat,lon) and x2(time). I am working on to get a correlation between a point and grid data. Both files have time=44 months (monthly values time series).
>
> Your kind suggestions and guidance will be of great.
>
> Thanks
>
> -Ibraheem
>
>
>
> ----- Original Message -----
> From: "Mary Haley" <haley_at_ucar.edu>
> To: "Ibraheem Khan" <khan18_at_atmos.uiuc.edu>
> Sent: Thursday, June 25, 2009 3:19:11 PM GMT -06:00 US/Canada Central
> Subject: Re: question
>
>
> I'm taking this offline for a bit.
>
> It makes no sense that copy_VarCoords is not copying the coordinates
> from from x1 to c.
>
> Where you have the code:
>
> c = escorc(x1(lat|:,lon|:,time|:),x2)
> copy_VarCoords(x1(0,:,:),c)
>
> Can you try the following:
>
> printVarSummary(x1)
> c = escorc(x1(lat|:,lon|:,time|:),x2)
>
> printVarSummary(x1)
> printVarSummary(x1(0,:,:))
> copy_VarCoords(x1(0,:,:),c)
> printVarSummary(c)
>
> and send me the output from all three?
>
> Also, what does "ncl -V" report?
>
> Thanks,
>
> --Mary
>
>
> On Thu, 25 Jun 2009, Ibraheem Khan wrote:
>
>> printVarSummary(x1):
>>
> Variable: x1
>> Type: float
>> Total Size: 585728 bytes
>> 146432 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [time | 44] x [lat | 52] x [lon | 64]
>> Coordinates:
>> time: [ 0..516]
>> lat: [24.125..36.875]
>> lon: [61.125..76.875]
>> Number Of Attributes: 1
>>
>> and
>>
>> printVarSummary(c):
>>
>> Variable: c
>> Type: float
>> Total Size: 13312 bytes
>> 3328 values
>> Number of Dimensions: 2
>> Dimensions and sizes: [52] x [64]
>> Coordinates:
>> Number Of Attributes: 1
>> _FillValue : -999
>>
>>
>>
>> Please guide how to handle this data...as i have started over scripts of NCL.
>> Thanks
>>
>> -Ibraheem
>>
>> ----- Original Message -----
>> From: "Mary Haley" <haley_at_ucar.edu>
>> To: "Ibraheem Khan" <khan18_at_atmos.uiuc.edu>
>> Cc: ncl-talk_at_ucar.edu
>> Sent: Thursday, June 25, 2009 2:46:55 PM GMT -06:00 US/Canada Central
>> Subject: Re: question
>>
>>
>> In order to plot data over a map, your data must either have 1D
>> latitude/longitude coordinate arrays attached to it, or you must have
>> 2D lat/lon arrays the same size as your data array containing the
>> lat/lon locations of your data.
>>
>> It looks like you attempted to copy the coordinate information
>> from "x1" to "c", but that it may not have been successful.
>>
>> What does:
>>
>> printVarSummary(x1)
>> printVarSummary(c)
>>
>> report?
>>
>> --Mary
>>
>>
>> On Thu, 25 Jun 2009, Ibraheem Khan wrote:
>>
>>> Mary,
>>>
>>> Now its showing map but without data. And giving following:
>>>
>>> (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'
>>>
>>> How to handle this?
>>>
>>> -Ibraheem
>>>
>>>
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "Mary Haley" <haley_at_ucar.edu>
>>> To: "Ibraheem Khan" <khan18_at_atmos.uiuc.edu>
>>> Cc: ncl-talk_at_ucar.edu
>>> Sent: Thursday, June 25, 2009 2:32:52 PM GMT -06:00 US/Canada Central
>>> Subject: Re: question
>>>
>>>
>>> You have
>>>
>>> res_at_gsnDraw = False
>>>
>>> This turns off drawing by the gsn_csm_xxxx function.
>>>
>>> Remove or comment this line out.
>>>
>>> --Mary
>>>
>>>
>>> On Thu, 25 Jun 2009, Ibraheem Khan wrote:
>>>
>>>> Hi David,
>>>>
>>>> I am using following script to calculate the point time series correlation with the time series grid data. But no output is turning up. Can you or anyone look at it to point out anything missing.
>>>> Thanks
>>>>
>>>> Script:
>>>>
>>>> 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
>>>> ;**********************************************
>>>> ; Reading Data and correlation function
>>>> ;**********************************************
>>>> f1 = addfile("6104_01.nc","r")
>>>> f2 = addfile("avg_6104_01.nc","r")
>>>> x1 = f1->a ;time series grid data
>>>> x2 = f2->a ;point time series
>>>> print(x1)
>>>> print(x2)
>>>> st = dim_standardize_Wrap(x2,1)
>>>> printVarSummary(st)
>>>> c = escorc(x1(lat|:,lon|:,time|:),x2)
>>>> copy_VarCoords(x1(0,:,:),c)
> <>>> printVarSummary(c)
>>>>
>>>> ;**********************************************
>>>> ; create plot
>>>> ;*********************************************
>>>> wks = gsn_open_wks ("x11","cor_prcp_01") ; open ps file
>>>>
>>>> gsn_define_colormap(wks,"radar")
>>>> res = True
>>>> res_at_gsnDraw = False
>>>> res_at_cnFillOn = True
>>>> res_at_cnLinesOn = False
>>>>
>>>> res_at_gsnSpreadColors = True
>>>> res_at_lbAutoLabelStride = True
>>>>
>>>>
>>>> res_at_cnLevelselectionMode = "ManualLevels" ; manually set cn levels
>>>> res_at_cnMinLevelValF = -1. ; min level
>>>> res_at_cnMaxLevelValF = 1. ; max level
>>>> res_at_tiMainString = ":F25:Prcp Point Corr"
>>>>
>>>> res_at_gsnLeftString = " "
>>>> res_at_tiMainFontHeightF = 0.03
>>>> res_at_gsnAddCyclic = False
>>>> ;printVarSummary(c)
>>>> plot = gsn_csm_contour_map_ce(wks,c,res)
>>>> end
>>>>
>>>>
>>>>
>>>> -Ibraheem
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: "Dave Allured" <dave.allured_at_noaa.gov>
>>>> To: ncl-talk_at_ucar.edu
>>>> Sent: Wednesday, June 24, 2009 8:58:50 PM GMT -06:00 US/Canada Central
>>>> Subject: Re: question
>>>>
>>>> Ibraheem,
>>>>
>>>> Point to grid correlation is easy. At each grid point, just compute
>>>> the correlation between the single point time series and the time
>>>> series for the grid point. The output from this is a single grid of
>>>> correlation numbers. Just plot this field, using any generic
>>>> contour plot function from NCL.
>>>>
>>>> How do you define correlation between two unequal regions? There
>>>> are various definitions. First you need to have a good mathematical
>>>> description of what you want, independent from any programming
>>>> considerations.
>>>>
>>>> One definition is a simple cross correlation where single grid
>>>> points at matching coordinates are correlated. If the regions are
>>>> different sizes, then this makes a plot that is only the size of the
>>>> small region, and blank in the remainder of the large region. This
>>>> is the third example on the correlation example page:
>>>>
>>>> http://www.ncl.ucar.edu/Applications/corel.shtml
>>>>
>>>> Another definition is to reduce the small region to a single time
>>>> series by a method of your choice, such as weighted or unweighted
>>>> averaging. Then compute and plot the gridded correlation of the
>>>> average time series to the larger region, similar to the single
>>>> point case.
>>>>
>>>> Yet another definition is to start at one grid point in the larger
>>>> region, and compute independent correlations to each point in the
>>>> smaller region. Then combine the resulting correlation numbers to a
>>>> single number by your choice of method, such as taking the mean or
>>>> median. Repeat over all grid points of the larger region, and once
>>>> again you have a single grid of numbers to plot in the usual way.
>>>>
>>>> Once you have decided on the definition, NCL has good matrix
>>>> capability to help with the computations.
>>>>
>>>> Dave Allured
>>>> CU/CIRES Climate Diagnostics Center (CDC)
>>>> http://cires.colorado.edu/science/centers/cdc/
>>>> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
>>>> http://www.cdc.noaa.gov/psd1/
>>>>
>>>> Ibraheem Khan wrote:
>>>>> Hi,
>>>>>
>>>>> I am thinking about drawing a correlation map. The correlation must be between a point value and gridded data. Also a correlation between two unequal gridded datasets (one covering a small region and the other a larger domain). Is it possible to do both correlations?
>>>>> Thanks
>>>>>
>>>>> -Ibraheem
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>> _______________________________________________
>>>> 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 Thu Jun 25 2009 - 15:18:13 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 29 2009 - 10:19:05 MDT