Re: Coloring land black in oceanic plot

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue, 24 Feb 2009 11:39:17 -0700

Hi Vinit,

You can try setting these resources:
res_at_cnMissingValPattern=0
res_at_cnMissingValFillColor = "black"
res_at_cnFillOn = True
res_at_cnMonoFillColor = True
res_at_cnFillColor = -1 ; transparent

If that doesn't work, or isn't the look you want, and you have the
bathymetry, you can use that and gsn_add_polygon to outline the terrain
and fill it in..
Adam

Vinit Asher wrote:
> Hi,
>
>
> I am plotting oceanic data in a lat vs level plot using isolines. I don't
> know how to color the land black. Kindly help. Below is my NCL script.
>
> Thanks and regards,
> Vinit Asher.
>
>
> ;*******************moc_iso_lines2.ncl***********************
> 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
>
> ;===== user defined params
>
> casename = "eofc2240.01"
> datelab_mn = "0950-0999"
> filename_mn="/ptmp/vasher/csm/"+casename+"/ocn/tseries/eofc2240.01.pop.h.TVT
> S.0950_cat_0999.nc"
> ;filename_mn =
> "/ptmp/nagaraj/data/b30.031/ocn/b30.031.pop.h.TVTS.0830_cat_0879.nc"
> plotname_mn =
> "/ptmp/vasher/plots/petm/"+casename+"/ocn/timeseries/MOC/"+casename+"_moc_bw
> _0950_0999_moc"
>
> ;==== read in files and variables
> fmn = addfile(filename_mn,"r")
>
> ;--test case
> time = fmn->time
> time = time/365.
> ;print("Time = "+time)
> itime= floattointeger(time)
> ntimes=dimsizes(itime)
>
> lev = fmn->lev ;meters
> nlev= dimsizes(lev)
>
> lat = fmn->lat
> nlat= dimsizes(lat)
>
> gmsf_mn = fmn->gmsf ;meridional stream function (time,lev,lat)
>
> print(casename+ " Data read")
>
> gmsf_avg = dim_avg(gmsf_mn(lev|:,lat|:,time|:))
>
> print("Averaging complete")
>
> wks = gsn_open_wks("ps",plotname_mn)
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
>
> ;define y axis for test case
> ilev = floattointeger(lev)
> ;ylabels = new(nlev,string)
> ylabels = new(6,string)
> ylabels(0) = "0"
> ylabels(1) = "1000"
> ylabels(2) = "2000"
> ylabels(3) = "3000"
> ylabels(4) = "4000"
> ylabels(5) = "5000"
> plot_mn = new(1,graphic)
>
> ; mos
> res = True
> res_at_gsnFrame = False
> res_at_gsnDraw = False
> res_at_vpWidthF = 0.8
> res_at_vpHeightF = 0.35
> res_at_gsnPaperOrientation = "portrait"
> res_at_cnFillOn = False
> res_at_cnLinesOn = True
> res_at_lbLabelStride = 3
> res_at_cnInfoLabelOn = True
> res_at_cnLineLabelsOn = True
> res_at_txFontHeightF = 0.017
> res_at_tmXBOn = True
> res_at_tmYLMode = "Explicit"
> res_at_tmYLPrecision = 2
> res_at_tmYLLabelFontHeightF = 0.015
> res_at_tiYAxisFontHeightF = 0.02
> res_at_tiMainFontHeightF = 0.02
> res_at_trYReverse = True
> res_at_gsnYAxisIrregular2Linear = True
> res_at_lbBoxMinorExtentF = 0.15
> res_at_lbLabelFontHeightF = 0.013
> res_at_cnLevelSelectionMode = "AutomaticLevels"
> ;res_at_cnLevelSelectionMode = "ExplicitLevels"
> res_at_cnLevelSelectionMode = "ManualLevels"
> res_at_cnMaxLevelValF = 40
> res_at_cnMinLevelValF = -30
> res_at_cnLevelSpacingF = 2
> ;res_at_lbLabelStride = 2
>
> res_at_cnLevels =
> (/-40.,-30.,-25.,-20.,-15.,-10.,-5.,0.,5.,10.,15.,20.,25.,30.,40./)
>
>
> ;test 0 - 5000m
> res_at_gsnCenterString = casename + " Global MOS - Annual Mean [yrs " +
> datelab_mn + "]"
> res_at_sfYArray = lev
> res_at_sfXArray = lat
> ;res_at_tmYLValues = lev
> res_at_tmXBLabelsOn = True ; do not draw bottom labels
> res_at_tmXBOn = True ; no bottom tickmarks
> res_at_gsnYAxisIrregular2Linear = True
> res_at_trYMaxF = 5000.
> res_at_trYMinF = 0.
> res_at_lbLabelBarOn = True
> res_at_tiYAxisString = "depth (m)"
> res_at_lbLabelBarOn = True
> plot_mn0 = gsn_csm_contour(wks,gmsf_avg,res)
> plot_mn(0) = plot_mn0
>
> resP = True
> resP_at_gsnMaximize = True
> gsn_panel(wks,plot_mn,(/1,1/),resP)
>
> system("convert -crop 0x0 -rotate 270 " + plotname_mn + ".ps" + " " +
> plotname_mn + ".png")
>
> print("MOS plotted")
>
> end
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 24 2009 - 11:39:17 MST

This archive was generated by hypermail 2.2.0 : Tue Mar 03 2009 - 09:53:57 MST