Re: Contour Smoothing

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Feb 27 2014 - 17:57:03 MST

Hi Brandi,
A cyclic point is, in this case, an added longitude line at say 360E to
ensure that the data on the longitude line just west of 360E gets
smoothed correctly. When the documentation says that the rightmost
dimension is to be treated as cyclic, it means that when smoothing the
last instance of the rightmost dimension the first instance of said
dimension is used. (ex. If your longitudes are every 2 degrees starting
at 0E and ending at 358E, the function will use data at 356, 358, and 0E
to smooth the data at 358E.)

With regards to what g represents in the example:
You included it in your email:
"Define g(ntim, nlvl, nlat, mlon) where ntim = 50, nlvl = 30, nlat = 64,
mlon = 128."

So g is of size 50(timesteps) x 30(levels) x 64(latitudes) x 128(longitudes)

The key with using smth9 and smth9_Wrap is that the two rightmost
dimensions of your input array must be latitude and longitude.

So, applying smth9 to your coding:
(st is dimensioned time x lat x lon)
st = smth9_Wrap(st, 0.50, 0.25, True) ; heavy local smoothing, use
smth9_Wrap to keep metadata
plot = gsn_csm_contour_map_ce(wks,st(0,{15:45},{250:270}), res)

Hope that helps. If not, or if you have further questions please respond
to ncl-talk only.
Adam

On 2/27/14, 1:46 PM, Clark, Brandi L wrote:
>
> I am trying to smooth the surface temperature contours on a
> cylindrical equidistant map of the CESM RCP 8.5 simulation for July
> 2020. I don't understand the documentation on the NCL webpage for the
> function smth9
> http://www.ncl.ucar.edu/Document/Functions/Built-in/smth9.shtml. It
> looks like I will need to use Example 2:
>
> Define g(ntim, nlvl, nlat, mlon) where ntim = 50, nlvl = 30, nlat =
> 64, mlon = 128.
>
> The rightmost dimension is to be treated as "cyclic". The user should
> /not/ add a cyclic point for the rightmost dimension; it is accounted
> for internally. All times and levels will be smoothed and returned in
> a new array/gsmth/.
>
> Note: /gsmth/ will not have any of the attributes or coordinate
> information of the input /g/. Note: gsmth will not have any of the
> attributes or coordinate information of the input g. If this is
> desired, use the *smth9_Wrap*
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/smth9_Wrap.shtml>function
> instead.
>
> gsmth =*smth9*(g, 0.50, 0.25, True) ; heavy local smoothing
>
>
> I am not sure what the parameters of g represent (ntim, nlvl, nlat, mlon), and I'm not sure what a cyclic point is.
>
> This is the code for my map, and I realize that the smoothing code is wrong. I just don't know what values to use.
>
> ; RCP 8.5 Surface Temperature Plot for year 2020
> ; July Monthly Average
> ; Cylindrical Equidistant Map
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> fname = addfile ("b40.rcp8_5.1deg.007.cam2.h0.2020-07.nc", "r"); read
> in file from path
> st = fname ->TS
> wks = gsn_open_wks("ps","RCP8.5_ST_2020_Map")
> gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
> res = True ; plot mods desired
> res@mpFillOn = False ; turn off gray fill
> res@mpOutlineBoundarySets = "geophysicalandusstates"; turn on
> countries and US states
> res@cnFillOn = True ; turn on color fill
> res@cnLinesOn = False ; turn off contour lines
> res@cnLevelSelectionMode = "ManualLevels"; set label bar manually
> res@cnMinLevelValF = 290 ; sets min temp on label bar
> res@cnMaxLevelValF = 310; sets max temp on label bar
> res@cnLevelSpacingF = 0.5 ; label bar interval
> res@lbLabelStride = 10
> res@lbBoxLinesOn = True; draw outline around
> individual colors
> res@gsnSpreadColors = True; use full range of colormap
> res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
> res@gsnAddCyclic = False ; data already has cyclic point
> ; this must also be set for any zoom
> ; note that the gsn_csm_*map_ce templates automatically set
> ; res@mpLimitMode="LatLon" for you. If you are plotting a different
> projection,
> ; you may have to set this resource.
> res@mpMinLatF = 20 ; range to zoom in on
> res@mpMaxLatF = 40
> res@mpMinLonF = 250
> res@mpMaxLonF = 270
> res@mpCenterLonF = 260
> g(ntim, nlvl, nlat, mlon)
> gsmth = smth9(g, 0.50, 0.25, True) ; heavy local smoothing
> plot = gsn_csm_contour_map_ce(wks,st(0,{15:45},{250:270}), res)
> end
> -Brandi
>
>
>
>
> _______________________________________________
> 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 Feb 27 17:57:17 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 03 2014 - 14:26:18 MST