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
Received on Fri Apr 18 2008 - 17:41:11 MDT
This archive was generated by hypermail 2.2.0 : Tue Apr 22 2008 - 09:55:07 MDT