Re: Cannot seem to "suppress" the large ("Missing_Val") arrows in my output plots....

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Oct 29 2009 - 11:10:06 MDT

Hi Jim,

I couldn't see your image, so I'm not sure what it looks like.

But, to set missing values, you need to set the "_FillValue" of your
data variables to whatever the missing value is.

For example, if your missing value is 1e20, then set:

u@_FillValue = 1.e20
v@_FillValue = 1.e20

It would be a good idea to get these missing values attached to your
variables on the NetCDF files, so you don't have to set them every
time you read the files in. I'm not sure how the files were created,
but you can try "fixing" them with the following (put this code at
the beginning, right after the "begin"):

--------------------------------
UNTESTED!!

  dir = "/amber/home/jpu/GulfBreeze/VectorPlots/"
  ufilename = "u3d_2009061100_nc_ascii.nc"
  vfilename = "v3d_2009061100_nc_ascii.nc"

; Make a backup copy of your files first, just in case.
  system("/bin/cp " + dir + ufilename + " " + dir + ufilename + ".bkup")
  system("/bin/cp " + dir + vfilename + " " + dir + vfilename + ".bkup")

;
; Open both NetCDF files in "write" mode so we can attach the
; _FillValue attribute to the variable on the file
;
  uf = addfile(dir + ufilename,"w")
  vf = addfile(dir + vfilename,"w")

; Attach the missing value to the variables on the file.
  uf->uu@_FillValue = 1.e20 ; Be sure to use the appropriate
values here.
  vf->vv@_FillValue = 1.e20

--------------------------------

To check if the _FillValue indeed got written correctly, you can do
an "ncl_filedump" on the file. This is at the UNIX command line:

   ncl_filedump /amber/home/jpu/GulfBreeze/VectorPlots/
u3d_2009061100_nc_ascii.nc
   ncl_filedump /amber/home/jpu/GulfBreeze/VectorPlots/
v3d_2009061100_nc_ascii.nc

Look for the "uu" and "vv" variables, and you should see something
like this:

       float uu ( ...some dimensions here... )
          _FillValue : 1e+20

--Mary

On Oct 29, 2009, at 10:23 AM, McCormick.JohnW@epamail.epa.gov wrote:

>
>
>
>
> I am sorry to have to give you so much "stuff" (pic and scripts),
> but I do have a question about suppressing or diminishing the
> "_Missing Values" for U / V plots.... I happen to have some ocean
> current (netcdf) files for the Northern Gulf (at sealevel) and the
> large arrows that you can see on the vector plot (below) are the
> "Missing_Values" data that I cannot seem to find anything
> (parameters, attributes, etc.) in the resources (list of ncl
> attributes) to stop these large ("Missing_Values") from being
> displayed. Please let me know if you might be able to give me any
> ideas on this ...
>
> (Example Plot is below and also, I have included my entire ncl-
> script just below the plot)..
>
> Thanks,
>
> John McCormick
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ========================================================
>
>
>
> 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
> ; dir = ncargpath("data")
> ; uf = addfile(dir+"/cdf/Ustorm.cdf","r") ; Open two netCDF files.
> ; vf = addfile(dir+"/cdf/Vstorm.cdf","r")
> uf = addfile("/amber/home/jpu/GulfBreeze/VectorPlots/
> u3d_2009061100_nc_ascii.nc","r") ; Open two netCDF files.
> vf = addfile("/amber/home/jpu/GulfBreeze/VectorPlots/
> v3d_2009061100_nc_ascii.nc","r")
> u = uf->uu(0,0,:,:) ; Get time, dep, lat, lon, data.
> v = vf->vv(0,0,:,:)
> lat = vf->v&lat
> lon = vf->v&lon
> ; wks = gsn_open_wks("x11","color") ; Open a workstation.
> wks = gsn_open_wks("png","color") ; Open a workstation.
> gsn_define_colormap(wks, "rainbow")
>
> nlon = dimsizes(lon)
> nlat = dimsizes(lat)
> ;
> #####################################################################
> ;
> #####################################################################
> ; ###
> ; ### Map Base for U-V plot -- ("mapbase")
> ; ###
> ;
> #####################################################################
> ;
> #####################################################################
> levels = (/30,35,40,45,50,55,60,65,70,75,80,85,90,95,100/)
> labels = (/"30","35","40","45","50","55","60","65","70","75","80",
> "85",\
> "90","95","100"/)
> nlevels = dimsizes(levels)
>
> res1 = True
> res1@gsnFrame = False ; don't advance
> frame yet
> res1@mpDataBaseVersion = "Ncarg4_1" ; higher res
> data base
> res1@vpWidthF = 0.90 ; change aspect
> ratio of plot
> res1@vpHeightF = 0.90
> res1@vpXF = 0.05
> res1@vpYF = 0.95
> res1@mpGeophysicalLineColor = "black"
> res1@mpGeophysicalLineThicknessF = 2.0
> res1@mpNationalLineColor = "black"
> res1@mpNationalLineThicknessF = 1.5
> res1@mpUSStateLineColor = "green"
> res1@mpUSStateLineThicknessF = 1.5
>
>
>
>
> res1@mpFillOn = True ; turn on map fill
> res1@mpLandFillColor = "orange" ; set to white
> ; res1@mpFillOceanColor = 0 ; (white)
> ; res1@mpDefaultFillColor = "red"
> res1@mpPerimOn = False ; don't draw box
> around map
> res1@mpGridAndLimbOn = True ; Yes, draw lat/
> lon lines.
> res1@mpGridLineColor = 1 ; Turn on grid
> lat/lon lines
> res1@mpGridSpacingF = 1.0 ; lat/lon lines
> every 2 deg
> res1@mpGridLineDashPattern = 2 ; lat/lon lines
> as dashed
> ; res1@mpFillAreaSpecifiers = states ; area names
> ; res1@mpSpecifiedFillColors = statecolors ; area colors
> res1@mpOutlineOn = True ; turn on map
> outline
> res1@mpOutlineBoundarySets = "USStates" ; turn on state
> boundaries
> res1@tiMainFontHeightF = 0.018 ; font height of
> title
> res1@tiMainString = "Ocean Current (Sea Level) in m/sec."
> res1@gsnMaximize = True ; blow up plot
> ;***************************************************
> ; map resources for projection
> ;***************************************************
> res1@mpProjection = "LambertConformal" ; choose
> projection
> res1@mpLambertParallel1F = 28.5 ; two parallels
> res1@mpLambertParallel2F = 31.0
> res1@mpLambertMeridianF = -89.0 ; central meridian
> res1@mpLimitMode = "LatLon"
> res1@mpMinLatF = 27.5 ; map area
> res1@mpMaxLatF = 30.7 ; map area
> res1@mpMinLonF = -92.2
> res1@mpMaxLonF = -86.0
> res1@gsnDraw = False ; draw picture
> res1@gsnFrame = False ; advance frame
> mapbase = gsn_csm_map(wks,res1) ; Draw map.
> ; draw(mapbase)
> ; frame(wks)
>
> res = True
>
>
> ; ###############################################################
> ; cn Stuff
> ; ###############################################################
> res@cnLevelSelectionMode = "ManualLevels" ; set manual
> contour levels
> res@cnMinLevelValF = -5. ; set min contour
> level
> res@cnMaxLevelValF = 5. ; set max contour
> level
> res@cnLevelSpacingF = .1 ; set contour spacing
> res@cnLinesOn = False ; contour lines
> res@cnFillOn = False ; turn on color fill
> res@cnLineLabelBackgroundColor = "white" ; white bckgrnd
> around label
> res@cnFillDrawOrder = "preDraw" ; Put continents
> on top
> res@cnMissingValPerimOn = True
> res@cnMissingValFillColor = 0
> res@cnMissingValFillPattern = 0
> res@gsnScalarContour = True ; contours desired
> res@gsnSpreadColors = True ; use full color map
> res@gsnMajorLatSpacing = 1 ; change maj lat tm
> spacing
> res@gsnMajorLonSpacing = 1 ; change maj lon tm
> spacing
> res@gsnDraw = True ; draw picture
> res@gsnFrame = True ; advance frame
> res@gsnContourZeroLineThicknessF = 3.5
> ; res@gsnPaperOrientation = "auto"
> ; res@gsnPaperHeight = 11.0
> ; res@gsnPaperMargin = 0.5
> ; res@gsnOrientation = "auto"
> res@gsnLeftString = "Temperature" ; left string
> title
> res@gsnRightString = "(Degrees, C.)" ; right string
> title
> res@gsnCenterString = " aaaaaaa " ;right string title
> res@gsnMaskLambertConformal = True
> res@gsnBoxMargin = 1.0
> res@mpMinLatF = 27.5 ; map area
> res@mpMaxLatF = 30.7 ; map area
> res@mpMinLonF = -92.2
> res@mpMaxLonF = -86.0
> res@pmLabelBarOrthogonalPosF = -0.01 ; move label bar
> closer
> res@lbLabelStride = .02
> ; ###############################################################
> ; lb Stuff
> ; ###############################################################
> res@lbLabelStride = 1 ; stride on
> label bar
> res@lbOrientation = "vertical" ; ncl default is
> vertical
> res@lbTitleString = "Ocean Current Vectors (Temp. in m/
> sec.) "
> res@lbTitlePosition = "Right"
> res@lbTitleOffsetF = 0.05
> res@lbTitleAngleF = 90.0
> ; res@lbTitleDirection = "Up"
> res@lbLabelFontHeightF = .019
> res@lbLabelOffsetF = 0.05
> res@lbTitleFontHeightF = .022
>
>
> res@vfXCStartV = lon(0) ; Define lat/lon corners
> res@vfXCEndV = lon(nlon-1) ; for vector plot.
> res@vfYCStartV = lat(0)
> res@vfYCEndV = lat(nlat-1)
> res@mpLimitMode = "Corners" ; Zoom in on the plot area.
> res@mpLeftCornerLonF = lon(0)
> res@mpRightCornerLonF = lon(nlon-1)
> res@mpLeftCornerLatF = lat(0)
> res@mpRightCornerLatF = lat(nlat-1)
> res@vpXF = 0.1 ; Increase size and change location
> res@vpYF = 0.92 ; of vector plot.
> res@vpWidthF = 0.75
> res@vpHeightF = 0.75
> res@vcMinFracLengthF = 0.33 ; Increase length of
> res@vcRefMagnitudeF = 15.0
> res@vcRefLengthF = 0.045
> res@vcMonoLineArrowColor = True ; Draw vectors in color.
> res@vcLineArrowColor = "blue" ; change vector color
> res@vcMinMagnitudeF = 0.001 ; vectors.
> res@vcLineArrowThicknessF = 0.03 ; change vector thickness
> res@vcMinDistanceF = 0.09 ; thin out vectors
> res@vcFillArrowsOn = True ; Fill the vector arrows
> res@vcFillArrowEdgeColor = 1 ; Draw the edges in black.
> res@vcFillArrowWidthF = 0.055 ; Make vectors thinner.
>
> vplot = gsn_vector(wks,u,v,res)
> draw(vplot)
> frame(wks)
> ; vplot = gsn_vector_map(wks,u,v,res) ; Draw a vector plot of u
> and v.
> overlay(mapbase,vplot)
> draw(mapbase)
> frame(wks)
> ; vmap = gsn_vector_scalar(wks,u,v,False,res) ; Draw a vector
> plot of u and v.
> ; plot = gsn_vector_scalar(wks,u,v,res) ; Draw a vector plot of
> ; map = gsn_vector_map(wks,u,v,res) ; Draw a vector plot of
> ; u and v over a map.
> end
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> John W. McCormick, Systems Programmer / DBA
> High Performance Computing & Scientific Visualization
> Lockheed Martin Information Technology, Supporting the EPA
> Research Triangle Park, NC
> 919-541-0890
>
> Federal Infrastructure Contact - Ravi Nair
> 919-541-5467 - nair.ravi@epa.gov
> Federal Infrastructure Contact - Joe Retzer, Ph.D.
> 919-541-4190 - retzer.joseph@epa.gov
>
> ############################################
> ### Work
> Information ###
> ############################################
> John W. McCormick, Systems Programmer, MD: N127-01
> Lockheed Martin, Contractor to US-EPA
> US-EPA, Bldg NCC, Rm N135B
> Durham, NC 27711
> Office: 919-541-0890
> Fax : 919-541-0056
> Work Email: mccormick.johnw@epa.gov
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Oct 29 11:10:04 2009

This archive was generated by hypermail 2.1.8 : Mon Nov 02 2009 - 08:49:47 MST