Question About gsn_csm_pres_hgt

From: Elizabeth Wilson <Elizabeth.Wilson_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 03 2014 - 09:04:52 MDT

Hello,

I'm using the gsn_csm_pres_hgt function to plot pressure vs. longitude for a specific latitude. Right now, I'm just choosing an arbitrary latitude to see if the plot works. I do get a plot; however, I want the longitude values to appear on the x-axis. Right now, only the index values are showing up. I've tried messing with the tickmark options but that usually turns them off all together and nothing shows up. I'll post my code below and the image that is created. I'm not technically getting any errors but I can't get the longitude values to appear. Also, as an extension of this question, I've tried messing around with coordinate subscripting when using this function instead of picking an index; however, I get this error: (gridy_221) of (uwind_kts) does not have an associated coordinate variable. I've copied over all the coordinates from a previous variable so I wouldn't think it should be giving me this error. Any suggestions?

Thanks!

-Elizabeth

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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin

; ######### Open file ###############

f=addfile("/lustre-sas1/ewilson/UPP/postprd/narr-a_221_20121030_0000_000.grb","r")

lat2d=f->gridlat_221(:,:)
lat2d!1="lat"
lat2d!0="lon"
lat=f->gridlat_221(0,:)

lon2d=f->gridlon_221(:,:)
lon2d!1="lat"
lon2d!0="lon"
lon=f->gridlon_221(:,0)

dimy=dimsizes(lat)
dimx=dimsizes(lon)

uwind=f->U_GRD_221_ISBL(:,:,:)
;print(ind_nearest_coord(35.8189,lat,0))
;ind= ind(lat.eq.35.8189)
;print(ind)
;uwind!0="level"
;uwind!2="lat2d"
;uwind!1="lon2d"
;uwind@coordinates="lon2d lat2d"
;uwind@lat2d=lat2d
;uwind@lon2d=lon2d

uwind_kts=uwind*1.944
copy_VarCoords(uwind,uwind_kts)
printVarSummary(uwind_kts)
;copy_VarMeta(uwind,uwind_kts)
;uwind_kts!0="level"
;uwind_kts!2="lat2d"
;uwind_kts!1="lon2d"
;uwind_kts@coordinates="lon2d lat2d"
;uwind_kts@lat2d=lat2d
;uwind_kts@lon2d=lon2d

wks=gsn_open_wks("pdf","test")
gsn_define_colormap(wks,"WhBlGrYeRe")

pltres=True
pltres@gsnDraw=True
pltres@gsnFrame=True

pltres@gsnAddCyclic=False

plot=gsn_csm_pres_hgt(wks,uwind_kts(:,:,50),pltres)

delete(pltres)
delete(uwind_kts)

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 3 09:05:15 2014

This archive was generated by hypermail 2.1.8 : Thu Apr 03 2014 - 13:36:27 MDT