[ncarg-talk] help
Gracielle Siqueira
graciqueira17 at hotmail.com
Tue Mar 17 07:06:09 MDT 2015
Hi,
Could you help me ?
How delete of lines of contour map, call here "isolinhas" in portuguese.
Thanks
Date: Wed, 24 Dec 2014 08:30:49 -0700
From: haley at ucar.edu
To: liuy0813 at gmail.com
CC: ncarg-talk at ucar.edu
Subject: Re: [ncarg-talk] help for basemap overlay with contour_vector map
In the future, please post your questions to ncl-talk and not ncarg-talk. This email list is for people using NCAR Graphics.
You need to subscribe to ncl-talk before you can post:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Regarding your problem: You cannot overlay two maps using NCL. You should have gotten an error when you tried to do this:
overlay(map,plot1)
because both "map" and "plot1" are maps.
You can try using gsn_csm_vector_scalar instead of gsn_csm_vector_scalar_map, and then you will also need to remove all the map resources you are setting with vres1.
Also, gsn_csm_contour should have worked just fine, and show the lat/lon coordinates, because you have lat2d and lon2d attached as attributes.
Please see the two "try1.ncl" and "try2.ncl" scripts. Since you didn't provide the data file, I can't run them to guarantee they work. try1.ncl uses gsn_csm_vector_scalar, and try2.ncl uses both gsn_csm_contour and gsn_csm_vector.
--Mary
On Mon, Dec 22, 2014 at 6:41 PM, 刘勇 <liuy0813 at gmail.com> wrote:
hi ,
I want to draw a contour and vector plot on a self-define coastline,my code shows below,First I try to draw a basemap ,then use gsn_csm_vector_scalar_map to draw contour and vector map, finally try to overlay this two map,but the coastline of my first map were overlayed by the second map.I also try this way: First draw the basemap, then draw contour map through gsn_csm_contour(wks,out,res),but this doesn't show the lon&lat infomation of out,and can't overlay to my basemap.hope U can help me.
thxs.
liuy
fig show below:http://oneputao.qiniudn.com/zonal.pnghttp://oneputao.qiniudn.com/current.png
code are there:;*************************************************
; plot_xmbay.ncl;;*************************************************;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "./ROMS_utils.ncl"undef("create_map")function create_map(wks,title,resolution)local a, res2begin res2 = True res2 at mpDataBaseVersion = resolution res2 at gsnMaximize = True res2 at gsnDraw = False res2 at gsnFrame = False res2 at mpOutlineOn = False res2 at mpFillOn = False ;---Turn on fancier tickmark labels. res2 at pmTickMarkDisplayMode = "Always" lon1=117.80 lat1=24.20 lon2=118.35+15.0/60.0 lat2=24.4+25.0/60.0;---Zoom in on area of interest res2 at mpLimitMode = "Corners" res2 at mpLeftCornerLatF = lat1 res2 at mpLeftCornerLonF = lon1 res2 at mpRightCornerLatF = lat2 res2 at mpRightCornerLonF = lon2 ;res2 at tiMainString = title; res2 at mpGridAndLimbDrawOrder = "Predraw";---Create map. map = gsn_csm_map(wks,res2) return(map)endbegin;************************************************; User settings;************************************************ fhis="roms_his_2010_nouse.nc" outfile = "roms_5" depth = -2.0 rec = 1;***********************************************; Read data and interpolate;*********************************************** his = addfile (fhis,"r") lon2d = his->lon_rho lat2d = his->lat_rho out = roms_3d_interp(his,"salt",rec,depth) ur = roms_3d_interp(his, "u", rec, depth) ; they are automatically put to "rho" vr = roms_3d_interp(his, "v", rec, depth) angle = his->angle uvrot = uv_rot(ur,vr,angle) urr = uvrot(0,:,:) vrr = uvrot(1,:,:) delete(uvrot) delete(ur) delete(vr) urr at lat2d = lat2d urr at lon2d = lon2d vrr at lat2d = lat2d vrr at lon2d = lon2d out at lat2d = lat2d out at lon2d = lon2d minValue = 0.0 maxValue = 35.0 step = 1 stride = 5 ;************************************************ ; create plot ;************************************************ wks_type = "x11" ; or "eps" wks_type at wkOrientation = "Portrait" wks = gsn_open_wks (wks_type, outfile) ; open workstation gsn_define_colormap(wks, "BlAqGrYeOrRevi200") i = NhlNewColor(wks,0.8,0.8,0.8) ; add gray to colormap reso="HighRes" title="Coast draw test" map = create_map(wks,title,reso) data=asciiread("./ranges/bigzone_zhu.txt",-1,"float") temp=reshape(data,(/dimsizes(data)/2,2/)) lat0=temp(:,1) lon0=temp(:,0) lnres = True lnres at gsLineThicknessF = 3.0 lnres at gsLineColor = "brown" lnres at gsFillColor = "gray" lnres at gsLineColor = "black" ln0 = gsn_add_polygon(wks,map,lon0,lat0,lnres) ln2 = gsn_add_polyline(wks,map,lon0,lat0,lnres);; Control appearance of map.; vres1 = True ; plot mods desired vres1 at gsnDraw = True vres1 at gsnFrame = True vres1 at gsnMaximize = True ; Maximize plot in frame; vres1 at gsnPaperOrientation = "Portrait"; vres1 at cnFillDrawOrder = "PreDraw" vres1 at cnFillOn = True ; turn on color for contours vres1 at cnLinesOn = False ; turn off contour lines vres1 at cnLineLabelsOn = False ; turn off contour line labels vres1 at cnFillMode = "RasterFill" vres1 at gsnScalarContour = True ; contours desired vres1 at gsnSpreadColors = True ; use full color map vres1 at gsnSpreadColorEnd = -2; vres1 at mpLandFillColor = "gray" ; set land to be gray vres1 at lbLabelBarOn = True vres1 at lbLabelStride = stride vres1 at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels vres1 at cnMinLevelValF = minValue ; set min contour level vres1 at cnMaxLevelValF = maxValue ; set max contour level vres1 at cnLevelSpacingF = step ; set contour spacing vres1 at lbOrientation = "Vertical" ; /Vertical label bar vres1 at pmLabelBarOrthogonalPosF = -0.01 ; move label bar closer vres1 at pmLabelBarDisplayMode = "Always" ; Turn on a label bar. vres1 at lbPerimOn = False ; no box around it vres1 at lbBoxLinesOn = True ; Yes/No labelbar box lines. vres1 at vcRefMagnitudeF = 1.0 ; define vector ref mag vres1 at vcRefLengthF = 0.045 ; define length of vec ref vres1 at vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector vres1 at vcRefAnnoParallelPosF = 0.108 vres1 at vcRefAnnoArrowLineColor = "black" ; change ref vector color vres1 at vcRefAnnoArrowUseVecColor = False ; don't use vec color for ref vres1 at vcRefAnnoString1 = "1.0 m/s" vres1 at vcLabelsOn = False vres1 at vcLineArrowColor = "black" vres1 at vcRefAnnoOn = True vres1 at vcMonoLineArrowColor = True ; vec's colored by their mag vres1 at vcLineArrowHeadMaxSizeF = 0.008 vres1 at vcLineArrowHeadMinSizeF = 0.0055 vres1 at vcMinDistanceF = 0.0145 ; thin vectors , xishu with big data vres1 at vcLineArrowThicknessF = 1.5 ; change vector thickness vres1 at vcGlyphStyle = "CurlyVector" ; turn on curly vectors lon_in1=117.80 lat_in1=24.20 lon_in2=118.35+15.0/60.0 lat_in2=24.4+25.0/60.0; MAP; vres1 at mpProjection = "Mercator" vres1 at mpLimitMode = "Corners" ; choose range of map vres1 at mpLeftCornerLatF = lat_in1 vres1 at mpLeftCornerLonF = lon_in1 vres1 at mpRightCornerLatF = lat_in2 vres1 at mpRightCornerLonF = lon_in2 vres1 at mpDataBaseVersion = "HighRes" ; use high resolution coast vres1 at pmTickMarkDisplayMode = "Always" ; turn on tickmarks plot1= gsn_csm_vector_scalar_map(wks,urr,vrr,out,vres1) overlay(map,plot1) draw(map) frame(wks)end
_______________________________________________
ncarg-talk mailing list
ncarg-talk at ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
_______________________________________________
ncarg-talk mailing list
ncarg-talk at ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncarg-talk/attachments/20150317/54a83c21/attachment-0001.html
More information about the ncarg-talk
mailing list