Hi Valkhorn,
I think the problem is that you have res_at_tfDoNDCOverlay set to True,
which tells NCL that you don't want the data to go through any kind of
transformation when it is drawn on the plot. NCL hence tries to draw
the data (contours) in the same space as what you set up the map to
be, which, in this case, is a larger area than the actual space that
the data resides in.
Try commenting out this resource, and see if the results look more
like what you were expecting.
I added a light blue color to the end of your color map, and then used
this to fill your ocean in this color. If you don't like the color I
chose, then you can either pick a different color in
your existing color map, and use this index value as the
value to "res_at_mpOceanFillColor".
Or, if you want a different color, you can go to:
http://www.ncl.ucar.edu/Document/Graphics/named_colors.shtml
to look at some colors. Click on any one of the thumbnails to see a
larger image. Once you find the name of a color you like, say, "pale
turquoise" (which is what I used here), then go to:
http://www.ncl.ucar.edu/Applications/Scripts/rgb.txt
and find that color in the list. This will give you the RGB
triplet:
175 238 238 pale turquoise
Divide these three numbers by 255, and these are the three numbers you
can use in the call to "NhlNewColor". I've attached the script so you
can see what I'm talking about.
I can see where this is kind of tedious. I will look into having
a new function that allows you to add a new color by name, rather
than by RGB triplet. For example:
ltblue = NhlNewNamedColor(wks,"PaleTurquoise")
--Mary
On Fri, 18 Apr 2008 Valkhorn_at_aol.com wrote:
> So I'm finally figuring out how to use this software, and I must say it's
> pretty amazing. I have a few questions though with the script below:
>
> ;*******************************************************
> ; lcnative_2.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
> ;************************************************
> ; open file and read in data
> ;************************************************
> stationfile="data.txt"
> ;
> ; -1 means read all rows into a one-dimensional variable,
> ; ATTENTION, DO NOT READ STRINGS.
> ;
> dummy = asciiread(stationfile,-1,"float")
> ncol = 3 ; number of columns is 3
> npts = dimsizes(dummy)/ncol ; get number of points
>
> stationdata = onedtond(dummy,(/npts,ncol/)) ; npts x ncol
>
> vpt = stationdata(:,2) ; station data
> lat = stationdata(:,0) ; latitude values
> lon = stationdata(:,1) ; longitude values
> ;************************************************
> ; create plot
> ;************************************************
> wks_type = "pdf"
> wks_type_at_wkOrientation = "portrait"
> wks = gsn_open_wks(wks_type,"map") ; open a workstation
> gsn_define_colormap(wks,"WhViBlGrYeOrReWh") ; choose colormap
>
> res = True ; plot mods desired
> res_at_tiMainString = "High Temperature Sample"
> ;************************************************
>
> res_at_mpLimitMode = "Corners" ; choose range of map
> res_at_mpLeftCornerLatF = 20
> res_at_mpLeftCornerLonF = -125
> res_at_mpRightCornerLatF = 55
> res_at_mpRightCornerLonF = -60
>
> ;************************************************
>
> res_at_mpProjection = "LambertConformal"
> res_at_mpLambertParallel1F = 10
> res_at_mpLambertParallel2F = 10
> res_at_mpLambertMeridianF = -100
>
> res_at_sfXArray = lon
> res_at_sfYArray = lat
>
> res_at_pmTickMarkDisplayMode = "Always"
> res_at_mpFillOn = True ; turn off map fill
> res_at_mpOutlineDrawOrder = "PostDraw" ; draw continental outline last
> res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state boundaries
> res_at_mpAreaMaskingOn = True
>
> ;res_at_mpFillColors = (/0,9,28,25/)
> ;res_at_mpMaskAreaSpecifiers = (/"Conterminous US"/)
>
> ;****************************************************************************
> ; usually, when data is placed onto a map, it is TRANSFORMED to the specified
> ; projection. Since this model is already on a native lambert conformal grid,
> ; we want to turn OFF the tranformation.
> ;****************************************************************************
> res_at_tfDoNDCOverlay = True
> ;****************************************************************************
> res_at_cnFillOn = True ; color plot desired
> res_at_cnLinesOn = False ; turn off contour lines
> res_at_gsnSpreadColors = True ; use full range of colormap
> res_at_gsnAddCyclic = False ; regional data
> res_at_cnFillDrawOrder = "Draw"
>
> res_at_pmLabelBarWidthF = 0.9
>
> res_at_cnLevelSelectionMode = "ExplicitLevels"
> res_at_cnLevels = (/-40,-30,-20,-10,0,10,20,30,40,50,60,70,80,90,100,110/)
>
> plot = gsn_csm_contour_map(wks,vpt,res)
>
> end
>
> (And do let me know if the script doesn't show up correctly)
>
> The script takes an ascii file that has three columns - Lat, Lon, and a
> value that I'm plotting
>
> Here is the output and data file:
> _http://68.63.208.24/maplamb.pdf_ (http://68.63.208.24/maplamb.pdf)
> _http://68.63.208.24/data.txt_ (http://68.63.208.24/data.txt)
>
> Here are my questions:
>
> 1) The plots are mostly in the eastern US. Yet, it is plotting points all
> the way to the left of the chart. How can I make it so that it actually plots
> the lat/lon coordinates correctly on the right part of the map? Do I need to
> code the points differently?
>
> 2) It seems to want to guess for points that don't exist - is there any way
> I can just leave white space where the points are not there?
>
> 3) Can I color the water light blue and set the contour for over land only?
>
> Thanks for your help!
>
> -William
>
>
>
> **************Need a new ride? Check out the largest site for U.S. used car
> listings at AOL Autos.
> (http://autos.aol.com/used?NCID=aolcmp00300000002851)
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.2.0 : Tue Apr 22 2008 - 09:55:07 MDT