[ncl-talk] Interpolation for taylor diagram
Sri Nandini
snandini at marum.de
Wed Mar 1 00:09:12 MST 2017
Hello
Thank you.
Im still at the interpolation stage of the script, what i wish to do is change the model temperature grid (lat,lon) same to my observational temperature.
To do that i followed:
fo = linint2(airw&lon,airw&lat,airw(time|:,lat|:,lon|:), True, LON, LAT, 0)
Which gives an error:
warning:linint2: xi, yi, xo, and yo must be monotonically increasing
My airw= [100 360 720] ;observed temp
My t2mw= [100 96 144] ' cesm modelled temp
My fo= [100 360 720] but the error comes when i apply the corr for taylor diag:
error: fatal:escorc: The last dimension of x must be equal to the last dimension of y
My code for corr is: re=escorc(airw,fo) where both datasets now have same grid.
Would anyone have a sample code to share if they were successful in running a taylor diagram after interpolating the datasets please? and applied centered corr and rsmd?
Deeply appreciated
On Feb 28, 2017 7:36:15 PM, Adam Phillips wrote:
> Hi Sri,> The error message is telling you what the issue is:
> > fatal:linint2: The rightmost dimensions of fi must be nyi x nxi, where nyi and nxi are the lengths of yi and xi respectively
> > fi is your input array, and the error message is saying that the rightmost dimensions of fi must be equal to the sizes of the lon and lat arrays that you pass in.
>
> > Thus, if you pass in your t2mw array to linint2 like this:
> > fo = linint2(t2mw&lon,t2mw&lat,t2mw, True, LON, LAT, 0)
> > should work as lon and lat are the 2 rightmost dimensions of t2mw. However, if you pass in your airw array:
> > fo = linint2(airw&lon,airw&lat,airw, True, LON, LAT, 0)
> > You will get the referenced error message as time is the rightmost dimension in airw. The solution is to reorder the dimensions in airw:
> > fo = linint2(airw&lon,airw&lat,airw(time|:,lat|:,lon|:), True, LON, LAT, 0)
>
> > Hope that helps. If you have any further questions please respond to the ncl-talk email list and not to me personally.
> > Adam
>
>
>
> On Tue, Feb 28, 2017 at 8:43 AM, Sri Nandini > <> snandini at marum.de> >> wrote:
> > Thank you
> >
> > So i have cleaned out the commented statements, and the errors i am getting are these:
> >
> > fatal:linint2: The rightmost dimensions of fi must be nyi x nxi, where nyi and nxi are the lengths of yi and xi respectively
> >
> > printVarSummary(t2mw)
> > Dimensions and sizes: [time | 100] x [lat | 192] x [lon | 288]
> > printVarSummary(airw)
> > Dimensions and sizes: [lat | 62] x [lon | 162] x [time | 100]
> > It stops at the interpolation stage before even coming to the correlation section.
> > Basically i am unsure of my interpolation method between observations and model output data.
> >
> > On Feb 24, 2017 4:28:11 PM, Dennis Shea wrote:
> > > I started to look at your code. However, it has lots of commented statements and, to me, it is not clear what is happening. Really, you should send only clean scripts. We like to help but we don't have the time to > > > decipher codes.
> > >
> > > The commented
> > >
> > > ;cor1 = dim_avg_n_Wrap(pattern_cor( t2mw, airw, clat, 0), 0)
> > >
> > > contains
> > > > > > http://www.ncl.ucar.edu/Document/Functions/Contributed/pattern_cor.shtml
> > >
> > > What is wrong with the following:
> > >
> > > printVarSummary(t2mw)
> > > printVarSummary(airw)
> > > pcor = pattern_cor( t2mw, airw, clat, 0)
> > > print(pcor)
> > >
> > >
> > >
> > > > > >
> > >
> > > On Thu, Feb 23, 2017 at 9:03 AM, Sri Nandini > > > <> > > snandini at marum.de> > > >> > > wrote:
> > > > Dear NCL community,
> > > > Greetings!
> > > >
> > > > I am trying to plot seasonal (DJF) Taylor diagrams and have errors in interpolation my datasets on same grid.
> > > > (a) read 2 data sets with different resolutions and regrid
(modelled and obs temperature for a test)
> > > > (b) calculate a pattern correlation
> > > >
> > > > My script is attached below ::
> > > >
> > > > ;=============================> > > > =====================================
> > > > ;Taylor diagram calculations
> > > > ;================================ interpolation onto common grid (of observational data)
> > > > ;ncl pattern_cor between different size arrays
> > > > t2mw = f->t2mw(0,0,:,{0:360}); remove cyclic point
> > > > lon = f->lon({0:360})
> > > > ;************************************************
> > > > ; interpolate to new grid
> > > > ;***********************************************
> > > > newlat = fspan(-60.,60,24)
> > > > newlon = fspan(0.,355.,72)
> > > >
> > > > newt2mw = linint2_Wrap(lon,t2mw&lat,t2mw,True,newlon,newlat,0)
> > > > newt2mw!0 ="lat"
> > > > newt2mw!1 = "lon"
> > > > newt2mw&lat = newlat
> > > > newt2mw&lon = newlon
> > > > ;=============================> > > > =========================================centered Pattern correlation (coslat weighting has been done previously above)
> > > > re=escorc(airw,newt2mw)
> > > > ;cor1 = dim_avg_n_Wrap(pattern_cor( t2mw, airw, clat, 0), 0);rc = pattern_cor(x, y,gw, 0) ; gaussian weighting, centered
> > > > mmd= (/cor1/)
> > > > printVarSummary(mmd)
> > > > ;================================Standard deviation ;================================
> > > >
> > > > ;pre0_Std = dim_avg_n_Wrap( dim_stddev_n_Wrap( t2mw, (/1,2/)), 0)
> > > > ;std1 = dim_rmsd_Wrap(airw,t2mw, 0);computes rootmean square difference
> > > > ;std1 = dim_rmsd_n(t2mw, airw, 0);
> > > > std1 = dim_rmsd( t2mw(lat|:,lon|:,time|:), airw(lat|:,lon|:,time|:) ) ; ==> rmsdTime(nlat,nlon)
> > > >
> > > > ;rmsdTime = dim_rmsd_n( x, y, 0 ) ; ==> no reordering needed
> > > > ================================================================
> > > > I had a look at other interpolation functions for correlations between different grids such a s:
> > > >
Assume > > > > fi> > > > is a 4D array dimensioned > > > > ntim> > > > x
> > > > nlvl> > > > x > > > > nlat> > > > x > > > > mlon> > > > (> > > > ntim> > > > =50,
> > > > nlvl> > > > =30, > > > > nlat> > > > =64, > > > > mlon> > > > =128), and that
the
rightmost dimension is to be treated as cyclic (the user should
not
add a cyclic point for the rightmost dimension).> > > >
> > > >
All times and levels will be interpolated and returned in a new
array
> > > > fo> > > > dimensioned > > > > ntim> > > > x > > > > nlvl> > > > x > > > > 73> > > >
x
> > > > 144> > > > :
> > > >
> > > > lon = (0., 2.8125, .... , 357,0125)
lat = (-87.8638, ... ,87.8638)
LON = (0., 2.5, ... , 357.5) ; length 144
LAT = (-90.,87.5,...90.) ; length 73
fo = > > > > linint2_Wrap> > > > (lon,lat,fi, True, LON,LAT, 0)
> > > > Error:
> > > >
> > > > Deeply appreciated
> > > >
> > > > _______________________________________________
> > > >
ncl-talk mailing list
> > > > ncl-talk at ucar.edu
> > > >
List instructions, subscriber options, unsubscribe:
> > > > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> > > >
> > >
> >
> > _______________________________________________
> >
ncl-talk mailing list
> > ncl-talk at ucar.edu
> >
List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
>
> --
> Adam Phillips
> > Associate Scientist, > Climate and Global Dynamics Laboratory, NCAR
>
> > www.cgd.ucar.edu/staff/asphilli/> > 303-497-1726
>
>
>
>
>
>
>
>
>
>
>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170301/5ab7224e/attachment.html
More information about the ncl-talk
mailing list