[ncl-talk] Misaligned correlation coefficient map

Mary Haley haley at ucar.edu
Fri Feb 12 14:39:01 MST 2016


You reordered the data with:

Jan_reorder=Jan_sce(x|:,y|:,time|:)

If "x" corresponds to longitude, and "y" to latitude, then you will be
unable to plot this over a map, because NCL expects the "latitude"
dimension to be the leftmost dimension.

You may need to transpose the array before plotting.

You also have to make sure "lat" and "lon" are in the right order as well.

--Mary


On Fri, Feb 12, 2016 at 1:44 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:

> Dear NCL,
>
> I would like to plot correlation coefficient, the snow cover extent by
> itself plots well. When I try to plot correlation coefficient it is
> misaligned, I am not sure why that is happening. I am attaching the plot
> with this email
> Any guidance will be helpful
>
>
>
> ;*********************************************************************************
> a=addfile("~/Documents/NCL_files/Snow_cover_IMS/NCL_codes/sce_mon_mean.nc","r")
> ; open output netCDF file
> b=addfile("~/Documents/NCL_files/Snow_cover_IMS/
> nhsce_v01r01_19661004_20140602.nc","r")
>
> ;Extracting time and snow cover extent (sce) from respective data files
>
>
> time_sce=a->time
>
>
> sce=byte2flt(a->sce)
>
> lat=b->latitude
> lon=b->longitude
>
> sce at lat2d=lat
> sce at lon2d=lon
>
> sce at _FillValue = 9.9621e+36
>
> ;==============================================
> ;Now lets correlate with JJAS
> JJAS_1871_2012
> =asciiread("~/Documents/NCL_files/SST/Monthly/jjas_1871_2012.txt",(/142,1/),"float")
> ;Extracting JJAS for 1967 to 2012
>
> JJAS_1967_2012=JJAS_1871_2012(96:141,0)
>
> ;============================================
> ;Extracting monthly data for sce
>
> Jan_sce = new((/46,88,88/),float)
>
> Jan_sce at _FillValue = 9.9621e+36
>
> ;==========================================
>
> do nyr=0,551,12
>
> Jan_sce(nyr/12,:,:) =sce(nyr,:,:)
>
> end do
>
>
> Jan_reorder=Jan_sce(x|:,y|:,time|:)
>
>
> corr_jan=escorc(Jan_reorder,JJAS_1967_2012)
>
>
> corr_jan at lat2d=lat
> corr_jan at lon2d=lon
>
> copy_VarCoords_1(sce,corr_jan)
>
> ;************************************************
> ; create plot
> ;************************************************
>   wks = gsn_open_wks("x11","Jan_sce_jjas_cor")               ;
>
> ;***********************************************
> ; create array of named colors. Note that you have
> ; to include the forground (white), and background (black)
> ; as the first two colors
> ;***********************************************
>
>   res = True                                     ; plot mods desired
>
>   res at tiMainString         = "January SCE and JJAS cor" ; plot title
>
>   res at cnFillOn             = True               ; turns on the color
>   res at mpFillOn             = False              ; turns off continent gray
>   res at cnLinesOn            = False              ; turn off contour lines
>
>   res at gsnPolar             = "NH"               ; specify the hemisphere
>   res at mpMinLatF            = 20               ; specify min lat
>
>   plot = gsn_csm_contour_map_polar(wks,corr_jan,res)
> ;=============================================
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160212/03ab8ccf/attachment.html 


More information about the ncl-talk mailing list