NCL Home> Application examples> Plot techniques || Data files for examples

Masking

mask_1.ncl: Demonstrates the use of the mask function and a masking array to mask out land or ocean.

The NCL mask function can be a bit confusing. It sets all values to missing that DO NOT equal the mask array. To mask out the ocean, you put in the land value and vice versa.

mask_2.ncl: Uses resources to draw land on top of the contours.

cnFillDrawOrder = "Predraw" draws the contours first. If necessary, you can also specify that the contour lines be drawn first as well by setting cnLineDrawOrder = "Predraw".

mask_3.ncl: Uses the mask function to leave only a range of the data.
mask_4.ncl: Uses the mpFillAreaSpecifiers and mpMaskAreaSpecifiers resources to indicate which map areas to fill and mask.
mask_5.ncl: The shea_util function landsea_mask can be used to create a landsea mask when one is not available for your particular dataset. This example demonstrates how to use landsea_mask to calculate a mask based on a particular resolution (in this case t85), and how to apply that mask to mask out all the ocean points from the data array.

The top plot shows the calculated T85 land sea mask. Note that at this resolution some islands (notably Hawaii) are not labeled as land or as small islands. This can be due to a variety of reasons, including the resolution of the data, the resolution of the 1x1 basemap, or whether the centers of the grid boxes are over the islands themselves. Note that the file that is returned by landsea_mask can be easily modified, as can the basemap that is downloadable off of the landsea_mask documentation page.

The bottom plot shows a surface temperature field at T85 resolution that has had the ocean points masked out by using the land sea mask shown in the top plot.