[ncl-talk] cross_corr_query
Kunal Bali
kunal.bali9 at gmail.com
Fri Sep 9 01:28:20 MDT 2016
I have the data over the central arabian sea with the time steps = 31.
With the given script, could you please let me know am I doing the
corss-correlation in a wright way
;*************************************************
; corel_3.ncl
;
; Concepts illustrated:
; - Calculating a two-dimensional correlation in time
; - Reordering an array
; - Copying attributes from one variable to another
; - Copying coordinate arrays from one variable to another
;
;************************************************
;
; These files are loaded by default in NCL V6.2.0 and newer
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
;************************************************
; open file and read in variable
;***********************************************
in1 = addfile("/media/Local Disk/NPL2/cross_corr_spatial/var1.nc","r")
in2 = addfile("/media/Local Disk/NPL2/cross_corr_spatial/var2.nc","r")
tmp1 = in1->DUD
tmp2 = in2->SRT
;************************************************
; reorder to get time as right most dimension
;***********************************************
ts1 = tmp1(latitude|:,longitude|:,time|:)
ts2 = tmp2(latitude|:,longitude|:,time|:)
;************************************************
; calculate cross correlations
;************************************************
maxlag = 3 ; set lag
; note, the max lag should not be more than N/4
ccr = esccr(ts1,ts2,maxlag) ; calc cross correlations
; copy meta data and coordinate variables using contributed functions
copy_VarAtts(ts1, ccr)
copy_VarCoords_1(ts2,ccr)
;************************************************
; plot the correlations
;************************************************
;************************************************
;---Open workstation and change color map
wks_type = "png"
wks = gsn_open_wks(wks_type, "CCR_2_lag3")
;************************************************
res = True ; make plot mods
res at gsnLeftString = ""
res at gsnRightString = ""
res at gsnAddCyclic = False
res at cnFillOn = True ; turn on color
res at cnFillPalette = "BlWhRe" ; set color map
res at cnLinesOn = False ; turn off contour lines
res at cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
res at cnMinLevelValF = -1. ; min level
res at cnMaxLevelValF = 1. ; max level
res at cnLevelSpacingF = .1 ; contour level spacing
lag = 3
res at tiMainString = "Correlations at lag "+lag
res at mpMinLonF = 59.8
res at mpMaxLonF = 69.8
res at mpMinLatF = 16.5
res at mpMaxLatF = 25.0
plot = gsn_csm_contour_map(wks,ccr(:,:,lag),res)
;************************************************
end
Kunal Bali
Research Scholar
Radio & Atmospheric Science Division
CSIR - National Physical Laboratory
New Delhi - 110012
India
On Fri, Sep 9, 2016 at 12:28 PM, Will Hobbs <will.hobbs at utas.edu.au> wrote:
> Kunal
>
>
>
> At least one of the data points in the arrays that you are correlating has
> every single value as ‘missing’ or the same value throughout. This usually
> occurs if your data includes some masked regions, e.g. ocean data with a
> spatial domain that includes land.
>
>
>
> Another possible valid condition would be precipitation data where one or
> more data points has been in drought for the entire time period, i.e. P = 0
> throughout
>
>
>
> If you’re expecting you input data to include masked areas or similar
> physical conditions then it’s probably nothing to worry about (although
> that doesn’t mean you shouldn’t check). If you’re not expecting any missing
> values in your data then you may have a problem with your input arrays –
> but that’s not really an NCL problem.
>
>
>
> Will
>
>
>
>
>
>
>
> *From: *<ncl-talk-bounces at ucar.edu> on behalf of Kunal Bali <
> kunal.bali9 at gmail.com>
> *Date: *Friday, 9 September 2016 at 4:46 PM
> *To: *"ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
> *Subject: *[ncl-talk] cross_corr_query
>
>
>
> Dear NCL users,
>
> I am trying to plot the cross-correlation map. While doing this, I have
> baeen facing one error
>
> warning:esccr: Non-fatal conditions encountered: all missing or constant
> values
>
> Could anyone please let me know, how to fix it.
>
> Regards
>
> Kunal Bali
>
>
>
> University of Tasmania Electronic Communications Policy (December, 2014).
> This email is confidential, and is for the intended recipient only.
> Access, disclosure, copying, distribution, or reliance on any of it by
> anyone outside the intended recipient organisation is prohibited and may be
> a criminal offence. Please delete if obtained in error and email
> confirmation to the sender. The views expressed in this email are not
> necessarily the views of the University of Tasmania, unless clearly
> intended otherwise.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160909/01dc861a/attachment.html
More information about the ncl-talk
mailing list