Creating and Using a Region-Of-Interest Mask

A vgf file is created using the interactive product generation tools within NMAP2. A closed line is drawn enclosing the region of interest, and a text label is grouped with the line assigning a value of 1 to the contour.

Once the region of interest is defined, a grid file can be created using the GRPHGD standalone program (It can also be created using the graph-to-grid option in NMAP2).

Create grid from VGF file with GRPHGD

GEMPAK-GRPHGD>
GDOUTF   = 2007071900_cmask.grd
GUESS    =  
PROJ     = MER
GRDAREA  =  
KXKY     = 10;10
MAXGRD   = 200
CPYFIL   = #A218
ANLYSS   =  
CNTRFL   = cmask.info
GDATTIM  = 070719/0000f000
GFUNC    = cmask
GLEVEL   = 0
GVCORD   = none
KEYCOL   =  
KEYLINE  =  
OLKDAY   =  
GGLIMS   =  
HISTGRD  = NO
BOUNDS   =  
TYPE     = C
GAMMA    = 0.3
SEARCH   = 20
NPASS    = 2
QCNTL    =  
GUESFUN  =  
CATMAP   =  
DISCRETE =  
DLINES   = yes;no|-0.5
GGVGF    = conusoutline_cmask.vgf
EDGEOPTS =
GEMPAK-GRPHGD>r

Check with GDINFO

GEMPAK-GDINFO>
GDFILE   = 2007071900_cmask.grd
LSTALL   = YES
OUTPUT   = T
GDATTIM  = all
GLEVEL   = 0
GVCORD   = none
GFUNC    = cmask
GEMPAK-GDINFO>r

GRID FILE: cmask.gem                                                                                           

GRID NAVIGATION: 
    PROJECTION:          LCC                 
    ANGLES:                25.0   -95.0    25.0
    GRID SIZE:          614 428
    LL CORNER:              12.19   -133.46
    UR CORNER:              57.33    -49.42

Number of grids in file:     1

 NUM       TIME1              TIME2           LEVL1 LEVL2  VCORD PARM
   1     070719/0000F000                          0         NONE CMASK       
GEMPAK-GDINFO>

The parameter CMASK is created where values greater than 1 are enclosed by the contour. DLINES defines the epsilon of (here -0.5 is used since the contour was drawn counterclockwise) to add to vlaues on either side of the single contour to be define greater / less than the contour value of 1.0.

The grid point values of SGT(cmask,1) (greater than 1.0) as shown here:

Plot with GDPLOT2

The resultant grid can ge used with the MASK() function and logical operators to define mask or clipping regions of interest. As an example, the 24 hour precipitation in the top panel is masked by the region of interest in the lower panel so that only data within the region of interest will be considered.

GDFILE  = nam12 + 2007071900_cmask.grd                                                                                 
GDATTIM  = f030
GLEVEL   = 0
GVCORD   = none
PANEL    = t     ! b
SKIP     = 0
SCALE    = 0
GDPFUN   = p24i  ! mask(p24i,sgt(cmask^070719/0000f000+2,1))
TYPE     = f
CONTUR   = 3/3
CINT     = 0
LINE     = 2/1/2
FINT     = .01;.1;.25;.5;.75;1;1.25;1.5;1.75;2;2.5;3;4;5;6;7;8;9
FLINE    = 0;21-30;14-20;5
HILO     =  
HLSYM    =  
CLRBAR   = 1
WIND     = BM1
REFVEC   =  
TITLE    = 1
TEXT     = 0.7/2/SW
CLEAR    = YES
GAREA    = us
IJSKIP   =  
PROJ     = STR/90;-100;0

Using GDCSV to find local maximas

The HIGH() function can be used to obtain local maximas from the grid region of interest. The GWFS() gaussian weighted smoothing function can be used to reduce higher frequency features in the grid and focus on broader areas of interest. By using the GDCSV program, the locations of HIGH() output are output to a file for use in determining local mesoscale model domain centers. By masking the region, the model domains are ensured to be within the desired region.

GEMPAK-GDCSV>l
GDATTIM  = f030
GDFILE   = nam12 + 2007071900_cmask.grd
GLEVEL   = 0
GAREA    = grid
PROJ     = def
GVCORD   = none
GFUNC    = high(mask(gwfs(p24i,40),sgt(cmask^070719/0000f000+2,1)),30)
SCALE    = 0
OUTPUT   = f/p24i_highs.dat
GEMPAK-GDCSV>r

OUTPUT is to the text file p24i_highs.dat. You can use the sort command to return the top two local maxima:

sort -t, -k 5bnr p24i_highs.dat | head -2

 508,     244,        42.3889,       -72.2385,        2.53370
 338,     236,        42.9560,       -96.3721,        0.58850

These two values are now scriptable (use |head -1 for the first and | head -2 | tail -1 for the second) both for plotting regional areas of interest and for WRF domains. A WRF lesson is outside the reach of this document, but as an example of what is run at Unidata, here is are the primary and secondary regions

Plotting again with GDPLOT2 and GPANOT

The locations of the 2 greatest local maximas (42.3889,-72.2385 and 42.9560,-96.3721) are shown along with the precipitation forecast field. The primary and secondary domains can be drawn using GPANOT to overlay the boxes.

First plot masked precipitation, same as above, but change PANEL = 0 and CLEAR = n

GDFILE   = nam12 + 2007071900_cmask.grd                                                                                 
GDATTIM  = f030
GLEVEL   = 0
GVCORD   = none
PANEL    = 0
SKIP     = 0
SCALE    = 0
GDPFUN   = mask(p24i,sgt(cmask^070719/0000f000+2,1))
TYPE     = f
CONTUR   = 3/3
CINT     = 0
LINE     = 2/1/2
FINT     = .01;.1;.25;.5;.75;1;1.25;1.5;1.75;2;2.5;3;4;5;6;7;8;9
FLINE    = 0;21-30;14-20;5
HILO     =  
HLSYM    =  
CLRBAR   = 1
WIND     = BM1
REFVEC   =  
TITLE    = 1
TEXT     = 0.7/2/SW
CLEAR    = YES
GAREA    = us
IJSKIP   =  
PROJ     = STR/90;-100;0
CLEAR    = n
r

Displaying Ensemble Grids

Displaying Ensemble Grids

What types of Ensemble data are there?

  • control (initial analysis and/or forecast)
  • member (perturbations of the control run)
  • average (computed from members)
  • spread (computed from members)
  • probabilistic (computed from members)

Special ensemble functions

GEMPAK provides a special set of functions, all of which are named beginning with ENS_, to do specific calculations over multiple members of an ensemble. The constitution of the ensemble is specified as a GDFILE entry by listing file names and aliases, separated by commas and enclosed in curly brackets {}. For specific functions available see the GPARM online documentation.

Example

The GFS model provides deterministic output at the 72 hour forecast time for 6 hour accumulated precipitation (P06M) and boundary layer CAPE as shown in GDPLOT2 using:

GDFILE   = gfs004
GDATTIM  = f072
GLEVEL   = 0 ! 180:0
GVCORD   = none ! pvbl
SCALE    = 0
GDPFUN   = p06m ! cape
TYPE     = f ! c
CONTUR   = 3/3
CINT     = 300
LINE     = 2/1/2
FINT     = .25;2.5;6.35;12.7;19.05;25.4;31.75;38.1;44.45;50.8;63.5;76.2;101.6;127;152.4;177.8 
FLINE    = 0;21-30;14-20;5 
GAREA    = us
PROJ     = STR/90;-100;0  

The figure above shows several large areas of precipitation with low CAPE values. We also see several areas with large cape values and little precipitation.

By utilizing the ensemble members, we can quantify the probability of precipitation exceeding .25mm (red contour lines), and CAPE values exceeding 500 J Kg^-2 (yellow shading) using 20 members of the global ensemble forecast system (gefs) in GDPLOT2 using:

GDFILE   = {gefs}
GDATTIM  = f072
GLEVEL   = 0 ! 180:0
GVCORD   = none ! pvbl
SCALE    = 0
GDPFUN   = ens_prob(gt(p06m,.25)) ! ens_prob(gt(cape,500))
TYPE     = c ! f
CONTUR   = 3/3
CINT     = 0.2
LINE     = 2/1/2
FINT     =  ! .5;1.2
FLINE    =  ! 0;5/7 

Observing the plot above, we can visually detect several regions where precipitation probability and CAPE values might suggest likely areas of thunderstorm activity where the two contour regions intersect. We can quantify the combined probability by using the logical operator AND() to compute the combined probability of both conditions as shown below:

GDFILE   = {gefs}
GDATTIM  = f072
GLEVEL   = 0
GVCORD   = none
SCALE    = 0
GDPFUN   = ens_prob(and(gt(p06m,.25),gt(cape@180:0%pvbl,500)))
TYPE     = f
CONTUR   = 3/3
CINT     = 
LINE     = 
FINT     = .1/.1
FLINE    = 0;23-13/7

Update on 13.2.1 Grib Decoder Threads

Since the last update, which involved testing only the ingest and decoding of CONDUIT 0.5/2.5 degree GFS, I've opened up the NGRID and NEXRAD3 feeds, as well as text and satellite products from the WMO and NIMAGE feeds, respectively.

 The goal is to compare the speed of the grid decoder on high-resolution CONDUIT GFS runs alone versus running in parallel with the full nationwide NEXRAD3 feed and other products.

[Read More]

Testing 13.2.1 Unified Grib Decoder on CONDUIT GFS

Last month we received the first version of AWIPS II which included the new unified grib decoder (13.1.2). The install procedure for 13.1.2 was more complicated than usual - we needed the full 13.1.1 installation plus a 13.1.2 "update" - so around 8 GB of RPMs to manage. 

If you're unfamiliar with what the unified grib decoder is, here's a quick rundown: before 13.1.2, the D2D perspective (for WFOs) and the National Centers Perspective (for NCEP centers) required separate data decoders and database tables for grib messages. D2D used a decoder called grib, while NCP used a decoder called ncgrib. If you didn't want to bog down your system, you could only run one at a time, meaning: depending on your server configuration, gridded model data would only be visible in one perspective, not both.
[Read More]

Introducing IDV 5.0 - Lynx!

Introducing IDV 5.0 - code name Lynx!

[Read More]
Unidata Developer's Blog
A weblog about software development by Unidata developers*
Unidata Developer's Blog
A weblog about software development by Unidata developers*

Welcome

FAQs

Developers' blog

Recent Entries:
Take a poll!

What if we had an ongoing user poll in here?

Browse By Topic
« June 2013
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
      
Today