Re: problem regridding

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 24 Feb 2006 15:35:56 -0700 (MST)

Ummm, I speculate NCL is doing what it is "told" :=)

newlat = fspan(-90.,90.,90)
newlon = fspan(0.,360.,180) ; <=== this include the cyclic value
                                 ; this is not correct

The above are rather novel lat / lon grids. :-)

given the nlat=90 and mlon=180 more conventional would be

newlat = fspan(-89.,89.,90) ; [ -89,-87 ..., 87,89]
newlon = fspan(1.,359.,180) ; [1,3,...,357,359]

though with contributed.ncl, I'd use

newlat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
newlon = lonGlobeFo(mlon, "lon", "longitude", "degrees_east")

===
If u want pole pts [note 91 and 181]

newlat = fspan(-90.,90.,91)
newlon = fspan(0.,359.,181)

or better

newlat = latGlobeFo( 91 , "lat", "latitude", "degrees_north")
newlon = lonGlobeFo(181 , "lon", "longitude", "degrees_east")

====

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
in =
addfile("/data/brownmc/sresa1b/working/sresa1b_ncar_ccsm3_0_run1_209001_209912_2
00001_200912_diff.nc","r")

sst = in->tas(0,:,:)
printVarSummary(sst) ; always send this ... it helps

newlat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
newlon = lonGlobeFo(mlon, "lon", "longitude", "degrees_east")

newsst = linint2_Wrap(sst&lon,sst&lat,sst,True,newlon,newlat,0)
printVarSummary(newsst)

good luck

>Delivered-To: shea_at_ucar.edu
>Delivered-To: ncl-talk_at_ucar.edu
>Date: Fri, 24 Feb 2006 13:58:46 -0800 (PST)
>From: brownmc_at_uci.edu
>To: ncl-talk_at_ucar.edu
>User-Agent: SquirrelMail/1.4.5
>MIME-Version: 1.0
>Content-Transfer-Encoding: 8bit
>X-Virus-Scanned: amavisd-new at ucar.edu
>Subject: problem regridding
>X-BeenThere: ncl-talk_at_ucar.edu
>X-Mailman-Version: 2.1.1
>List-Id: NCAR Command Language User Group <ncl-talk.ucar.edu>
>List-Unsubscribe: <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>,
<mailto:ncl-talk-request_at_ucar.edu?subject=unsubscribe>
>List-Post: <mailto:ncl-talk_at_ucar.edu>
>List-Help: <mailto:ncl-talk-request_at_ucar.edu?subject=help>
>List-Subscribe: <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>,
<mailto:ncl-talk-request_at_ucar.edu?subject=subscribe>
>X-Virus-Scanned: amavisd-new at ucar.edu
>
>Hi all,
>I have been trying to regrid some model data, but when I use the bilinear
>interpolation (linint2) it keeps plotting the data 180 degrees off the
>orginal grid (ex. temp data for australia is now plotted over south
>america). I have put my script below. Any help is greatly appreciated.
>
>Mike
>
>p.s. if I am not describing the problem fully, I have posted a plot of the
>orginal grid and of the new grid that is off at dust.ess.uci.edu/brownmc
>it is called regrid_problem.pdf
>
>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/shea_util.ncl"
>begin
>in =
>addfile("/data/brownmc/sresa1b/working/sresa1b_ncar_ccsm3_0_run1_209001_209912_
200001_200912_diff.nc","r")
>
>sst = in->tas(0,:,:)
>lon = in->lon({0.:360})
>
>newlat = fspan(-90.,90.,90)
>newlon = fspan(0.,360.,180)
>newsst = linint2(lon,sst&lat,sst,True,newlon,newlat,0)
>
>newsst!0 ="lat"
>newsst!1 = "lon"
>newsst&lat = newlat
>newsst&lon = newlon
>
>wks = gsn_open_wks("X11","regrid") ; open a ps file
> gsn_define_colormap(wks,"gui_default") ; choose colormap
> res = True ; plot mods desired
> res_at_cnFillOn = True ; turn on color
> res_at_gsnSpreadColors = True ; use full color map
> res_at_cnLinesOn = False ; no contour lines
> res_at_cnLineLabelsOn = False ; no line labels
> ;res_at_mpMaxLatF = 60 ; choose map range
> ;res_at_mpMinLatF = -60
> res_at_gsnDraw = False ; don't draw yet
> res_at_gsnFrame = False ; don't advance frame yet
> ;res_at_cnLevelSelectionMode = "ManualLevels" ; manual levels
> ;res_at_cnMinLevelValF = 4 ; min level
> ;res_at_cnMaxLevelValF = 32 ; max level
> ;res_at_cnLevelSpacingF = 2 ; interval
> ;res_at_tmXBLabelFontHeightF = 0.014 ; adjust some font heights
> ;res_at_tmYLLabelFontHeightF = 0.014
> ;res_at_tiMainFontHeightF = 0.022
> ;res_at_txFontHeightF = 0.017
>
> res_at_lbLabelBarOn = False ; turn off label bar
>;************************************************
>; create plots
>;************************************************
> plot = new(2,graphic)
> res_at_tiMainString = "Original Grid"
> plot(0) = gsn_csm_contour_map_ce(wks,sst,res) ; create the plot
>
> res_at_tiMainString = "Grid after linint2"
> plot(1) = gsn_csm_contour_map_ce(wks,newsst,res) ; create the plot
>;************************************************
>; create panel
>;************************************************
> pres = True
> pres_at_gsnPanelLabelBar = True ; common label bar
> gsn_panel(wks,plot,(/2,1/),pres)
>
>end
>
>
>
>
>
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk_at_ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 24 2006 - 15:35:56 MST

This archive was generated by hypermail 2.2.0 : Mon Feb 27 2006 - 09:24:43 MST