Re: defining dimensions

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 16 Jun 2006 15:18:06 -0600 (MDT)

On Fri, 16 Jun 2006, Micah Sklut wrote:

> Hello,
>
> I am making sst contour maps, and my contours values seem to be slightly off
> as far
> as their lat/lon locations. As you can see in my script below, I take only a
> portion of the whole dataset. I recieve memory errors, when I try to read
> in the whole large 1/12 degree global dataset, and I'm only using the
> Atlantic values anyway. When I don't declare lat and lon variables, the
> output is exactly the same - so I'm thinking this might be where the problem
> is. The basic script is attached below:
> Thanks for any input you can give.

Hi Michah,

In order for your contour data to be overlaid on a map correctly,
it needs to know the latitude and longitude coordinates for each
data value. Generally, this is done via coordinate arrays that
are attached to your data values.

I can't tell from your script below if your lat/lon arrays are
associated with your sst file, but here's how you can
"attach" them so they become coordinate arrays of sst:

    ilat1 = 300 ; This is just to help avoid having
    ilat2 = 1500 ; to change all of your subscripts.
    ilon1 = 2700
    ilon2 = 3700
    f = addfile("sst.grb","r")
    sst = f->TMP_173_SFC(ilat1:ilat2,ilon1:ilon2)

    sst!0 = "lat"
    sst!1 = "lon"
    sst&lat = f->lat_173(ilat1:ilat2)
    sst&lon = f->lon_173(ilon1:ilon2)
    sst_at_lat@units = "degrees_north"
    sst_at_lon@units = "degrees_east"
    ...

Please give this a try and send me a personal email if this doesn't
work.

--Mary

> begin
>
> f = addfile("sst.grb","r")
> sst = f->TMP_173_SFC(300:1500,2700:3700)
> ;lat = f->lat_173(300:1500)
> ;lon = f->lon_173(2700:3700)
>
> sst = (sst-273) * 1.8 + 32
>
> res@mpMinLatF = minlat
> res@mpMinLonF = minlon
> res@mpMaxLatF = maxlat
> res@mpMaxLonF = maxlon
>
> wks = gsn_open_wks("ps",name_out)
> gsn_define_colormap(wks,"sstgraph ") ; choose colormap
>
> res = True ; plot mods desired
> res@mpDataBaseVersion = "Ncarg4_1"
> res@mpOutlineBoundarySets = "GeophysicalandUSStates"
> res@mpFillDrawOrder = "postDraw"
> res@gsnAddCyclic = False
>
> res@mpMinLatF = minlat
> res@mpMinLonF = minlon
> res@mpMaxLatF = maxlat
> res@mpMaxLonF = maxlon
>
> res@cnLevelSelectionMode = "ManualLevels"
> res@cnLevelSpacingF = 1.0
> res@cnMinLevelValF = 33.0
> res@cnMaxLevelValF = 92.0
>
> res@gsnSpreadColors = True
> res@gsnSpreadColorStart = 2
> res@gsnSpreadColorEnd = 62
>
> contour = gsn_csm_contour_map_ce(wks,sst,res)
>
> delete(res)
>
> end
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 16 2006 - 15:18:06 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 19 2006 - 10:29:51 MDT