[ncl-talk] How to correct the co ordinates?

Mary Haley haley at ucar.edu
Tue Mar 1 09:39:23 MST 2016


You didn't actually state what the problem was, so I guess you meant to say
that the plot is incorrect?

You didn't provide any information about your data.  As we tell users
frequently, use "printVarSummary" to help us see what what your variables
look like:

printVarSummary(B)

You shouldn't need to allocate space for B and then fill it. Try replacing
this code:

   B = new((/2487,88,88/),float)
   do i = 0,2486
      B(i,:,:)=sce(i,:,:)#sce_area(:,:)
   end do

with:

sce_area_3d = conform_dims(dimsizes(sce),sce_area,(/1,2/))
B           = sce # sce_area_3d

One idea for the plot: maybe you need to turn off the addition of a cyclic
point:

res at gsnAddCyclic = False

If none of this helps, then please include output from "printVarSummary" of
all your variables.

Thanks,

--Mary


On Mon, Feb 29, 2016 at 12:12 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:

> Dear NCL,
>
> I want to plot snow cover extent after multiplying it with snow cover
> area. Here is the code for it. I am also attaching the figure with this
> email.
>
> ;*******************************************
> ;Reading in the weekly snow cover extent
> ;*******************************************
>
> a=addfile("~/Documents/NCL_files/Sea_ice/nhsce_v01r01_19661004_20140602.nc
> ","r")
> sce=a->snow_cover_extent ; The values are either 0 or 1
>
> lat=a->latitude
> lon=a->longitude
>
> sce!1="lat"
> sce!2="lon"
>
> sce at lat2d=lat
> sce at lon2d=lon
>
> ;********************************************
> :Reading in the snow cover are
> ;********************************************
>
> sce_area=a->area
>
> sce_area!0="lat"
> sce_area!1="lon"
>
> copy_VarAtts(sce,sce_area)
> copy_VarCoords_1(sce,sce_area)
>
> ;*******************************************
> ;Muliplying Snow cover extent and Area
> ;*******************************************
>
> B = new((/2487,88,88/),float)
>
>      do i = 0,2486
>       B(i,:,:)=sce(i,:,:)#sce_area(:,:)
>       end do
>
> B!0="time"
> B!1="lat"
> B!2="lon"
>
> B at lat2d=lat
> B at lon2d=lon
>
> copy_VarAtts(sce,B)
> copy_VarCoords_1(sce,B)
>
> printVarSummary(B)
>
> B at _FillValue = -9
>
>
> ;************************************************
> ; create plot
> ;************************************************
>   wks = gsn_open_wks("pdf" ,"Snow_cover_area")
>   res            = True                          ; plot mods desired
>   res at gsnPolar   = "NH"                          ; specify the hemisphere
>   plot = gsn_csm_contour_map_polar(wks,B(0,:,:),res)    ; create the plot
>
>
> _______________________________________________
> 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/20160301/46b78a8c/attachment.html 


More information about the ncl-talk mailing list