Re: How to fix this image

From: Ipshita Majhi <ipmajhi_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 22 2014 - 13:04:51 MDT

Hi Alan and Karen,

I got the transparent color going and now the plot looks great!
Thank you both for your support so far

I wanted to put the box in the polar plot for Kara/Barent sea or Tibetian
Plateau. How can I do it in a polar plot. I know how to do it in simple
mercator plot.

How can I write a loop with all the time considered and extract and save
the date from the different boxes.

Thank you so much in advance.
Ipshita


On Tue, Jul 22, 2014 at 8:47 AM, Brammer, Alan P <abrammer@albany.edu>
wrote:

> To add to Karens resposne, the black box is because you have it set to
> plot no_snow pixels black. If you don’t want them black, then set=
 that
> color to something else ( e.g below)
>
>
> No_snow set to white;
>
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/ 0.5 /) ;;;; Only have 2 levels so only need 1
> contour between them.
> res@cnFillColors = (/ 0, 4 /) ;;;; 0 = “White”
> res@lbLabelStrings = (/"no_snow" , "snow_covered"/)
>
>
> No_snow set to transparent;
>
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = (/ 0.5 /) ;;;; Only have 2 levels so only need 1
> contour between them.
> res@cnFillColors = (/ -1, 4 /) ;;;;;; -1 = "Transparent"
> res@lbLabelStrings = (/"no_snow" , "snow_covered”/)
>
>
> The land/water type is a separate variable in the file, if you want that
> as well then you’ll have to add that to the mix somehow.
>
>
>
> To get into the lat / lon region extraction, take a look at the numerous
> functions and try and find one that fits your requirements.
>
> http://www.ncl.ucar.edu/Document/Functions/latlon_funcs.shtml
>
>
>
>
> Alan.
>
>
>
>
> On Jul 22, 2014, at 4:38, Karin Meier-Fleischer <meier-fleischer@dkrz.de=
>
> wrote:
>
> ;*******************************************
> 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"
>
> a =addfile("~/Documents/Snow_cover_IMS/nhsce_v01r01_19661004_20140602.=
nc
> ","r")
> sce=a->snow_cover_extent(0,:,:)
>
> lat=a->latitude ;-- if you want the complete array you
> don't have to use (:,:)
>
> print(lat(:,1))
>
> lon=a->longitude ;-- if you want the complete array you
> don't have to use (:,:)
>
> ;print(sce)
> ;print("Hello")
> ;printVarSummary(sce)
> ;printVarSummary(lat)
> ;printVarSummary(lon)
>
> ;;; delete_VarAtts(sce, -1) ;-- why are you deleting all variable
> attributes??
>
> ;Attaching variables
> ;;sce!0="lat2d" ;-- no
> ;;sce!1="lon2d" ;-- no
>
> sce@lat2d=lat
> sce@lon2d=lon
>
> printVarSummary(sce)
>
> ; Plotting code
>
> wks = gsn_open_wks("ps","sce_ims")
> gsn_define_colormap(wks,"default")
>
> res = True
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnLineLabelsOn = False
> res@cnFillMode = "rasterfill"
> res@cnMissingValFillColor = 28 ; "gray"
> ;
> ; Since the data is categorical, values between the categories need to be
> ; excluded. Use Explicit level selection to accomplish this.
> ;
> res@cnLevelSelectionMode = "explicitlevels"
> res@cnLevels = (/ 0.99,1.99, 2.99, 3.99, 4.99 /)
> res@cnFillColors = (/ 1, 4, 19, 6, 0, 1 /) ; (/"black", "blue", "green"=
,
> "yellow", "white", "black" /)
> res@lbLabelAlignment = "boxcenters"
> res@lbLabelStrings = (/ "water", "land", "ice", "snow" /)
> ;
> ; First draw the plot without projecting into map coordinates.
> ; This has the drawback that only index values are used as tick marks
> ; but it is fast
> ;
> res@gsnPolar = "NH" ; specify the hemisphere
> plot = gsn_csm_contour_map_polar(wks,sce,res) ; create the plot
> ;*******************************************
>
>
>

Received on Tue Jul 22 07:04:58 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT