Re: help with plotting a region within a GFS grib file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 27 Sep 2007 09:57:38 -0600

slp(:,{latS:latN},{lonW:lonE})

This just selects the data.

To draw a map .... As Siji indicated

   res_at_mpMinLatF = latS ; range to zoom in on
   res_at_mpMaxLatF = latN
   res_at_mpMinLonF = lonW
   res_at_mpMaxLonF = lonE

See example 3:
http://www.ncl.ucar.edu/Applications/cylineq.shtml

Erik Noble wrote:
> Hi and thank you to both.
>
> Siji,
> Thank you for pointing out the lonFlip command.
>
> Dennis,
> I need clarification...
> My region is
> latS = -25
> latN = 35
> lonW = -35
> lonE = 25
>
> If I use coordinate subscripting to call in my variable
> slp(:,{latS:latN},{lonW:lonE})
>
> do I still need to do all of the "selecting a subregion" part and if I
> do, would the syntax below be correct?
>
> lon2d_flip=slp&lon_3
>
> mpres_at_mpMinLonF = lon2d_flip({lonW})
> ; select a subregion
> mpres_at_mpMaxLonF = lon2d_flip({lonE})
> mpres_at_mpMinLatF = lat2d({latS)
> mpres_at_mpMaxLatF = lat2d({latN})
>
> -Erik
> On 9/27/07, Dennis Shea <shea_at_ucar.edu> wrote:
>> Yes .... FYI: You do not have to create a different variable.
>>
>> http://www.ncl.ucar.edu/Document/Functions/Contributed/lonFlip.shtml
>>
>> printVarSummary( slp ) ; before lonFlip
>>
>> slp = lonFlip( slp )
>>
>> printVarSummary( slp ) ; after lonFlip
>>
>> note the coordinate variables .... longitude [1-80 to +180]
>>
>> West Africa might be something like
>>
>>
>> latS = 5
>> latN = 35
>> lonW = -20
>> lonE = 25
>> slp(:,{latS:latN},{lonW:lonE}) ; coordinate subscripting
>>
>>
>>
>>
>> Sijikumar S wrote:
>>> Hi Erik,
>>> Map over West Africa crosses "Zero " degree longitude and reorder the
>>> longitude coordinate from "0 - 360" to "-180 -180" is a solution.
>>> Function "lonFlip" can do this.
>>> http://www.ncl.ucar.edu/Document/Functions/Contributed/lonFlip.shtml
>>>
>>>
>>> slp_flip=lonFlip(slp)
>>> lon2d_flip=slp_flip&lon_3
>>>
>>> mpres_at_mpMinLonF = lon2d_flip(145)
>>> ; select a subregion
>>> mpres_at_mpMaxLonF = lon2d_flip(215)
>>> mpres_at_mpMinLatF = lat2d(65)
>>> mpres_at_mpMaxLatF = lat2d(125)
>>>
>>>
>>> Siji
>>>
>>>
>>>
>>> On 9/26/07, *Erik Noble* <nobleeu_at_gmail.com <mailto:nobleeu_at_gmail.com>>
>>> wrote:
>>>
>>> Hi. I am trying to overlay several variables on a plot over aregion
>>> within a GFS file.
>>> The overlay part is easy.
>>>
>>> I am confused about why I am getting errors with plotting the map of
>>> the region (West Africa). My grid is 181 X 360.
>>>
>>> Why am I getting this error (Below)? Should not the gsn_csm_map_ce
>>> take care of this?
>>> Please help.
>>> -Erik
>>>
>>> Copyright (C) 1995-2007 - All Rights Reserved
>>> University Corporation for Atmospheric Research
>>> NCAR Command Language Version 4.3.1
>>> The use of this software is governed by a License Agreement.
>>> See http://www.ncl.ucar.edu/ for more details.
>>> (0) Working on time: 08_07_2006 00 UTC
>>> (0) gsn_csm_map_ce: Fatal: The resources
>>> mpMinLonF/mpLeftCornerLonF must be less than the resources
>>> mpMaxLonF/mpRightCornerLonF.
>>> (0) Execution halted.
>>>
>>> My code:
>>> begin
>>> ;************************************************
>>> a = addfile("../FNL_SOP3_08_2006/fnl_060807_00_00.nc","r")
>>>
>>> lat2d = a->lat_3 ;
>>> lon2d = a->lon_3 ;
>>>
>>> time = "08_07_2006 00 UTC"
>>> type = "pdf"
>>> wks = gsn_open_wks(type,"FNL-08-07")
>>> gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>> ; First get the variables we will need
>>>
>>> slp = a->PRMSL_3_MSL_10 ; slp (Pa)
>>> slp = slp/100 ;
>>> Turn Pressure into hPa
>>> slp_at_description = "Sea Level Pressure"
>>> slp_at_units = "hPa"
>>>
>>> tc2 = a->TMP_3_SFC_10 ; T (K) at surface (can be SST,
>>> too)
>>> tc2 = tc2-273.16
>>> tf2 = 1.8*tc2+32. ; Turn temperature
>>> into Fahrenheit
>>> tf2_at_description = "Surface Temperature"
>>> tf2_at_units = "F"
>>>
>>> ; Set some Basic Plot options
>>>
>>> mpres = True ; Create map background
>>> print("Working on time: " + time )
>>>
>>> mpres_at_gsnCenterString = "FNL Reanalysis" ; some titles
>>> mpres_at_gsnLeftString = "hPa"
>>> mpres_at_gsnRightString = "DegF" ; "~" is txFuncCode
>>> mpres_at_gsnCenterString = "Valid' + time'"
>>> mpres_at_gsnDraw = False ; don't draw
>>> mpres_at_gsnFrame = False ; don't
>>> advance frame
>>>
>>>
>>> mpres_at_mpGeophysicalLineColor = "Black"
>>> mpres_at_mpGeophysicalLineThicknessF = "3.0"
>>> mpres_at_mpGridLineColor = "Black"
>>> mpres_at_mpLimbLineColor = "Black"
>>> mpres_at_mpNationalLineColor = "Black"
>>> mpres_at_mpPerimLineColor = "Black"
>>> mpres_at_mpUSStateLineColor = "Black"
>>>
>>> mpres_at_lbOrientation = "Horizontal" ;
>>> vertical label bar
>>> mpres_at_lbLabelAutoStride = True ; optimal
>>> label stride
>>> mpres_at_gsnSpreadColors = True ;
>>> use full range of colors
>>>
>>> mpres_at_gsnAddCyclic = False
>>>
>>> mpres_at_mpCenterLonF = 0. ; center
>>> plot at 180
>>>
>>> mpres_at_mpMinLonF =
>>> lon2d(325) ; select a subregion
>>> mpres_at_mpMaxLonF = lon2d(35)
>>> mpres_at_mpMinLatF = lat2d(65)
>>> mpres_at_mpMaxLatF = lat2d(125)
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>> ; First get the variables we will need
>>>
>>> slp = a->PRMSL_3_MSL_10 ; slp (Pa)
>>> slp = slp/100 ;
>>> Turn Pressure into hPa
>>> slp_at_description = "Sea Level Pressure"
>>> slp_at_units = "hPa"
>>>
>>> tc2 = a->TMP_3_SFC_10 ; T (K) at surface (can be SST, too)
>>> tc2 = tc2-273.16
>>> tf2 = 1.8*tc2+32. ; Turn temperature
>>> into Fahrenheit
>>> tf2_at_description = "Surface Temperature"
>>> tf2_at_units = "F"
>>>
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>
>>> ; Plotting options for SLP
>>>
>>> ;mpres_at_gsnContourLineThicknessesScale = 2.0
>>> mpres_at_cnLevelSelectionMode = "ManualLevels" ; set
>>> manual contour levels
>>> mpres_at_cnMinLevelValF = 900. ; set min
>>> contour level
>>> mpres_at_cnMaxLevelValF = 1110. ; set max
>>> contour level
>>> mpres_at_cnLevelSpacingF = 4 ; set contour
>>> spacing
>>> mpres_at_cnLineColor = "NavyBlue"
>>> mpres_at_cnHighLabelsOn = True
>>> mpres_at_cnLowLabelsOn = True
>>> mpres_at_cnLineLabelBackgroundColor = -1
>>> mpres_at_cnFillDrawOrder = "Predraw" ; areas before
>>> map gets
>>>
>>> ; Plotting options for T
>>> mpres2 = True
>>> mpres2_at_cnFillOn = True
>>> mpres2_at_cnMinLevelValF = -20. ; set
>>> min contour level
>>> mpres2_at_cnMaxLevelValF = 90. ; set max
>>> contour level
>>> mpres2_at_cnLevelSpacingF = 5
>>> mpres2_at_gsnSpreadColorEnd = -3 ; End third from the last color
>>> in color map
>>>
>>> ; MAKE PLOTS
>>> plot = gsn_csm_contour_map_overlay(wks,slp,tf2,mpres,mpres2)
>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>
>>> end
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu <mailto: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
>>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 27 2007 - 09:57:38 MDT

This archive was generated by hypermail 2.2.0 : Mon Oct 01 2007 - 07:42:02 MDT