15.3 Masking Features at Land-Water Boundaries
McIDAS does not provide a direct way to display color-filled contours
of gridded data sets. Instead, one can convert gridded fields into
imagery that can then be colorized using the
EU
command and manipulated by a variety of imagery commands.
Many Unidata McIDAS users have asked if it is possible to clip contours
of gridded fields at land-water boundaries. The ability to do this is
particularly desired for gridded renditions of point source
measurements due to the paucity of observations over water. If one has
an image data set from which the land-water boundaries can be readily
discerned, then this data set can be used to select values from one
image that lie exclusively over land or sea for inclusion in a new
image product.
IMGFILT
generates a new image by
applying a filter mask to data from an existing image or images.
IMGFILT is routinely used to clean up images by applying a shot noise
filter to each element and is frequently used to identify cloudy
regions by comparing colocated image values from different spectral
channels.
All images used in the filtering process must have the same projection,
resolution and navigation. You can use the
IMGCOPY
or
IMGREMAP
before using IMGFILT.
- If a McIDAS session is not already running, start one with at
least six frames.
- Type: mcidas
at the Unix prompt.
Gridded Field Clipped to Eliminate Contours over Water
The first step in generating an image clipped using IMGFILT is
to generate an image representation of a gridded field. Before we can
do that, we need to locate a gridded field in McIDAS compatible
format.
- Point to the cooperating ADDE server operated at UCAR (adjust
the name to the server being used for workshop activities).
- Type: DATALOC ADD RTGRIBS UNI50.UCAR.EDU
- List the first ten gridded fields of the NAM-ALL dataset available on
the ADDE server.
- Type: GRDLIST RTGRIBS/NAM-ALL NUM=10
- Copy one of the gridded fields to a local data set.
- Type: GRDCOPY RTGRIBS/NAM-ALL MYDATA/GRIDS.132 PAR=T LEV=1000 DGRID=1
This copies the first 1000 mb Temperature grid found in the RTGRIBS/NAM-ALL
data set to the local MYDATA/GRIDS data set in position 132. The
gridded field being copied will be put into the first slot in the output
dataset
position by virtue of the DGRID=1 keyword specification.
Since we defined MYDATA/GRIDS to include all possible GRID data
files, position 132 will correspond to the file GRID0132
which, if
it does not already exist, will be created in your current McIDAS
working directory.
- Verify that the grid was copied to the local data set correctly.
- Type: GRDLIST MYDATA/GRIDS.132
If the grid was copied successfully, you will see a listing something
like:
GRDLIST MYDATA/GRIDS.132
Dataset position 132 Directory Title=
PAR LEVEL DAY TIME SRC FHOUR FDAY FTIME GRID PRO
---- --------- ------------ -------- ---- ----- ------------ -------- ----- ----
T 1000 MB 19 AUG 01231 00:00:00 NAM 0 19 AUG 01231 00:00:00 1 LAMB
Number of grids listed = 1
GRDLIST - done
- Convert the grid in GRID dataset MYDATA/GRIDS.132 to an image.
- Type: GRDIMG MYDATA/GRIDS.132 MYDATA/IMAGES.3020 MAG=7 7 PAR=T LEV=1000
- Display the resulting image and draw a map on it.
- Type: IMGDISP MYDATA/IMAGES.3020 1 SF=YES EU=IMAGE REFRESH='EG;MAP H'
We were able to refer to the image that was created in AREA file
AREA3020
as MYDATA/IMAGES.3020 by virtue of having defined the MYDATA/IMAGES
data set to include all images in AREA file format.
Note that the image representation of the gridded field extends well
beyond the coastal boundaries depicted by the map that was drawn.
Our next objective is to create a new image that excludes the data
portions that extend over water.
- Make a copy of the image just created.
- Type: IMGCOPY MYDATA/IMAGES.3020 MYDATA/IMAGES.3021 SIZE=ALL
We will use this copy to create a filter mask.
- Remap the global image topography data set into the copy just made.
- Type: IMGREMAP TOPO/GLOB MYDATA/IMAGES.3021 SMOOTH=YES
We remap the topography data into the image copy since the
topography data essentially has the descrimination between land and
water that we seek (the land having a greater elevation than water).
- Display the remapped topography image and draw a map on it.
- Type: IMGDISP MYDATA/IMAGES.3021 2 SF=YES EU=TOPO REFRESH='EG;MAP H'
- Use IMGFILT on the remapped topography image to create an image that
has only two brightness values: 0 over water, and 255 over land.
- Type: IMGFILT MYDATA/IMAGES.3021 MYDATA/IMAGES.3021 MYDATA/IMAGES.3022 FILTER=CORE 149 149 255 0
- Display the filter image and draw a map on it.
- Type: IMGDISP MYDATA/IMAGES.3022 3 SF=YES EU=IMAGE REFRESH='EG;MAP H'
- Now use IMGFILT with the filter image just created to mask out data
values that lie over water in the original image created from a grid.
- Type: IMGFILT MYDATA/IMAGES.3020 MYDATA/IMAGES.3022 MYDATA/IMAGES.3033 FILTER=DIS 0 255 1 255 0
- Display the filtered image in frame 4 and draw a map on top of it.
- Type: IMGDISP MYDATA/IMAGES.3033 4 SF=YES EU=IMAGE REFRESH='EG;MAP H'
- Step through all of the images.
- Type: LB 1 4
- Press: Alt A
Visualizing model data as imagery
The process of creating a land-water clipped image representation of a
grid can be automated. We have created a McBASI script -
CFILLCLP.MCB which can be used to create a
clipped or non-clipped representation from any gridded data field located
in accessible ADDE datasets.
- Try creating a color filled representation of a 12 hour forecast,
850 mb NAM Temperature field displaying the result in the current
frame using a colorful enhancement:
- Type: CFILLCLP RTGRIBS/NAM-ALL T 850 #Y 12 12 LAMB MYDATA/IMAGES.3020 Y Y SST
- Type: BAR