Re: regridding problem

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 17 Feb 2006 13:37:25 -0700

Hi Mike,

I think I see the issue:
sst = in->tas(0,0,:)

I believe what you want is:
sst = in->tas(0,:,:)

put a printVarSummary(sst) after each of those statements, and you will
see that the original line results in sst being a 1D array of size
sst&lon, while the replaced line will read in the first timestep's lat x
lon grid.

Good luck,
Adam

brownmc_at_uci.edu wrote:
> Hi all,
> This is my first time trying to regrid my data and I am having problems
> using one of the example scripts (regrid_1.ncl). I am just trying to use
> the script to learn how regridding works and I get an error early on
> saying- fatal:(lat) is not a named dimension in variable (sst). I have
> put a copy of my script below, if anyone has any advice or help I would
> greatly appreciate it. Thanks
>
> Mike Brown
>
> 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/atm/mo/tas/ncar_ccsm3_0/run1/sresa1b_ncar_ccsm3_0_run1_200001_209912.nc","r")
> ;in =
> addfile("/data/brownmc/sresa1b/working/sresa1b_ncar_ccsm3_0_run1_200001_200912_clm.nc","r")
> in =
> addfile("/data/brownmc/sresa1b/working/sresa1b_ncar_ccsm3_0_run1_209001_209912_200001_200912_diff.nc","r")
>
> sst = in->tas(0,0,:)
> lon = in->lon({0.:360.})
>
> newlat = fspan(-60.,60.,24)
> newlon = fspan(0.,355.,72)
> newsst = linint2(lon,sst&lat,sst,True,newlon,newlat,0) ;FAILS HERE
> 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@cnFillOn = True ; turn on color
> res@gsnSpreadColors = True ; use full color map
> res@cnLinesOn = False ; no contour lines
> res@cnLineLabelsOn = False ; no line labels
> res@mpMaxLatF = 60 ; choose map range
> res@mpMinLatF = -60
> res@gsnDraw = False ; don't draw yet
> res@gsnFrame = False ; don't advance frame yet
> res@cnLevelSelectionMode = "ManualLevels" ; manual levels
> res@cnMinLevelValF = 4 ; min level
> res@cnMaxLevelValF = 32 ; max level
> res@cnLevelSpacingF = 2 ; interval
> res@tmXBLabelFontHeightF = 0.014 ; adjust some font heights
> res@tmYLLabelFontHeightF = 0.014
> res@tiMainFontHeightF = 0.022
> res@txFontHeightF = 0.017
>
> res@lbLabelBarOn = False ; turn off label bar
>
> plot = new(2,graphic)
> res@tiMainString = "Original Grid"
> plot(0) = gsn_csm_contour_map_ce(wks,sst,res) ; create the plot
>
> res@tiMainString = "Grid after linint2"
> plot(1) = gsn_csm_contour_map_ce(wks,newsst,res) ; create the plot
>
> pres = True
> pres@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

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 17 2006 - 13:37:25 MST

This archive was generated by hypermail 2.2.0 : Fri Feb 17 2006 - 14:55:41 MST