Usage of NCL to Access HDF Files

1. Prerequisite

This document assumes that users have a basic knowledge of the following data formats and the corresponding software packages:

2. Introduction

In this document we describe how to use NCL[5] to access HDF files. We use NASA HDF files to show the procedures for accessing or visualizing the data with this program. For the general usages of these packages, please refer to their user's guides[6] or websites.

3. Sample Files

One HDF4external file and two HDF-EOS2 files were used to demonstrate how to access or visualize HDF data with these packages. These files are used to store data from the NASA Special Sensor Microwave/Imager (SSMI) Sensor [7] and the Advanced Microwave Scanning Radiometer for the EOS (AMSR-E) satellite system[8]. Table 1 shows the instrument names, formats and other information about these HDF4/HDF-EOS2 files. We also converted HDF-EOS2 files to netCDF-4 classic model-compliant and netCDF-4-compliant HDF5external files. In this document, we mainly refer to the instrument and the description of physical variables when specifying a file or a field in a file. However, the file names may be referred to in the code examples that appear throughout this document.

Instrument Description of Physical Variables Data Format Variations Projection
SSMI Ocean Wind Fields HDF4 Geographic
AMSR-E Rainfall Accumulations HDF-EOS2 grid 1. netCDF-4-compliant HDF5 2. netCDF-4 classic model-compliant HDF5 Geographic
AMSR-E Brightness Temperature, Sea Ice Concentration, Snow Depth over Sea Ice HDF-EOS2 grid 1. netCDF-4 classic model-compliant HDF5 Polar Stereographic
Table 1 Sample files

3.1. SSMI Ocean Wind Fields

The first file stores the NASA SSMI ocean wind fields data. In this document, we will use the two variables u10m and v10m that represent the U component and the V component of the wind field. Both variables have three dimensions: time (from January 2005 to December 2005), longitude, and latitude.

The file name is atlas.ssmi.ver02.level3.5_5day.s950103.hdf. Users can download this file from here.

3.2. AMSR-E Rainfall Accumulations

The second file (AE_RnGd) stores the NASA AMSR-E data that describes the monthly average rainfall accumulation over ocean and land in July 2007.

3.2.1. HDF-EOS2

The format of the original file is HDF-EOS2 . The original file name is AMSR_E_L3_RainGrid_B05_200707.hdf. Users can download this file from here.

We changed the extension from hdf to he2 when we accessed this file via NCLexternal.

3.2.2. NetCDF-4-compliant HDF5

We used the HDF4-to-HDF5 Conversion tool [9] to convert the AMSR-E HDF-EOS2 file to a netCDF-4-compliant HDF5external file. The converted file was renamed to either AMSR_E_L3_RainGrid_B05_200707.h5 or AMSR_E_L3_RainGrid_B05_200707.nc, as required by the software package processing it. Users can download this netCDF-4-compliant HDF5 file from here.

3.2.3. NetCDF-4 Classic Model-compliant HDF5

Since the netCDF-4 classic model[10] has more restrictions than the general netCDF-4 model, two steps are needed to create a netCDF-4 classic model-compliant HDF5 file. The first step is to create a netCDF-4-compliant HDF5 file as addressed in the previous section. The second step is to follow the procedure explained in Appendix 5.1. The file is called AMSR_E_L3_RainGrid_B05_200707_flatten.nc, and users can download this file from here.

3.3. AMSR-E Brightness Temperature, Sea Ice Concentration, Snow Depth over Sea Ice

The third file (AE_SI12) contains several fields that represent brightness temperatures, sea ice concentration, and snow depth over sea ice. This file is also from AMSR-E[11]. Unlike the other two files, the polar stereographic projection is used.

3.3.1. HDF-EOS2

The original file is an HDF-EOS2 file and the filename is AMSR_E_L3_SeaIce12km_B02_20020619.hdf. Users can download this file from here.

3.3.2. NetCDF-4 Classic Model-compliant HDF5

To create the netCDF-4 classic model-compliant HDF5external file, one needs to follow the same procedure described in Section 3.2.3. The converted file name is AMSR_E_L3_SeaIce12km_B02_20020619_flatten.nc. Users can download this file from here.

4. NCL

4.1. Overview

The NCAR Command Language (NCL) is an interpreted language designed for scientific data analysis and visualization. In this section, we explain how to install NCLexternal , read HDF4external and HDF5external files, and visualize them.

4.2. Installation

Although NCLexternal is free, registration is required to download it. One can find information regarding registration, downloading, and installation from http://www.ncl.ucar.edu/Download/external. For our examples, we used NCL 5.1.1.

NCAR distributes precompiled NCL binaries for several widely used platforms including AIX, IRIX, Linux, Mac OSX, Solaris, and cygwin. We used their Linux distribution, and it worked without any problems. Source code is also available, and building NCL from source code is documented at http://www.ncl.ucar.edu/Download/build_from_src.shtmlexternal.

4.3. How to Use

4.3.1. Introduction

The following code shows a typical way to use NCL to visualize a variable in a file. This code needs to be typed at the prompt that NCL shows.

Figure 1 A typical NCL code to read and plot data
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"

begin
file1 = addfile("filename", "r")
variable1 = file1->var1(:,:)
variable2 = file1->var2(0,:,:)

variable1@_FillValue = -1

xwks1 = gsn_open_wks("pdf","outputfile")

resources1 = True
resources1@tiMainFont = 21

plot1 = gsn_csm_vector_map_ce(xwks1,variable1,variable2,resources1)
end
The first line starting with load loads an NCL module that defines functions used in this NCL code.

An NCL code starts with the keyword begin and ends with the keyword end. The addfile() function is used to open a file. Two arguments need to be provided for this function. The first argument provides the file name and the second argument provides the file access mode, in this case, r, which represents read-only mode. This function returns the file descriptor, in this case, file1.

The file descriptor can be used to refer to a variable in the file. When referring to a variable, one can use NCL's subscript feature to select a specific portion of a variable. The explanation of subscripts used in NCL can be found in the "Subscript" section of NCL Language Reference Guide: Variables[12].

As shown in Figure 1, the entire data of data field var1, denoted as var1(:,:), are represented as an NCL variable, variable1. A subset of a data field var2, denoted as var2(0,:,:), is represented as NCL variable, variable2. The subsection of the first dimension of var2 is one element, the first element of this dimension. The subsections of the second and third dimensions include the whole sections of these dimensions.

NCLexternal tries to read dimensions, units, and fill values from variable attributes. When a variable does not have attributes, users need to manually provide the fill value for better visualization. To set the fill value -1 for variable1, for example, one can write a statement as variable1@_FillValue = -1. When two-dimensional dimension scales are associated with a variable, users need to write additional statements such as variable1@lon2d = lon, assuming that a variable, lon, contains longitude values.

To draw a plot, one needs to call gsn_open_wks() first to get a workstation descriptor. A workstation is an instance of an output device such as a screen or a file. The name of the descriptor in this example is xwks1 as shown in Figure 1. One of its arguments determines whether NCL draws a plot on the screen, or creates a file such as PDF or PostScript.

Users can customize a plot by setting attributes of a resource object created by assigning True. A resource object in NCL means configuration settings of a plot such as vector shapes, font sizes and colors of a plot. For example, the statement resources1@tiMainFont = 21 specifies that the font size of the main title is 21. For more information, refer to http://www.ncl.ucar.edu/Document/Graphics/Resources/index.shtmlexternal.

With a workstation and a resource object, one can draw a plot of variables by calling NCL APIs such as gsn_csm_vector_map_ce() or gsn_csm_contour_map_ce(). In this example, gsn_csm_vector_map_ce() is called. Since this example generates a vector plot with varible1 as one component of the vector and variable2 as another component of the vector, both variable1 and variable2 should be passed as parameters to gsn_csm_vector_map_ce(). For a contour plot, only one variable should be passed to the function gsn_csm_contour_map_ce().

4.3.2. Handle an HDF4 or HDF5 file

The extension of the file name passed to addfile() function is important because NCL detects the file format based on the extension. To open an HDF-EOS2 file whose extension is .hdf, for example, one needs to rename the actual file name or append .he2 to the argument.

When reading HDF-EOS2 fields, users need to be aware of the name mangling that occurs in NCL. Suppose that RrLandRain is a data field defined under a grid MonthlyRainTotal_GeoGrid; NCL flattens this structure and appends the grid name to the field name. As a result, the variable name becomes RrLandRain_MonthlyRainTotal_GeoGrid. To access this data field, users need to refer to this mangled name, not the pure data field name, RrLandRain.

4.3.3. Examples

In this section, we will explain how to visualize an HDF4 SDS (4.3.3.1), HDF-EOS2 (4.3.3.2, 4.3.3.4) and netCDF-4 classic model-compliant HDF5 (4.3.3.3, 4.3.3.3).

4.3.3.1. Visualize an HDF4 SDS

Figure 2 shows how to use NCL to read vectors from an HDF4 file and to draw a vector plot. We used the ocean wind fields data from the SSMI instrument.

Figure 2 NCL code to read and plot data from an HDF4 SDS
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
cdf_file = addfile("atlas.ssmi.ver02.level3.5_5day.s950103.hdf", "r")
u = cdf_file->u10m(0,:,:)
v = cdf_file->v10m(0,:,:)

xwks = gsn_open_wks("pdf","ssmi")
resources = True
plot = gsn_csm_vector_map_ce(xwks,u,v,resources)
end
The above code reads part of two HDF4 SDSs (u10m and v10m) and draws a vector plot over a cylindrical equidistant map.

With some additional settings, the plot shown in Figure 3 can be generated. The unabridged code with the full resources variable setting is provided in Appendix 5.2.

4.3.3.2. Visualize an HDF-EOS2 File that has 1-D Coordinate Variables

Figure 4 shows code to read an HDF-EOS2 field and draw a contour plot.

Figure 4 NCL code to read and plot grid data from an HDF-EOS2 file
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
cdf_file = addfile("AMSR_E_L3_RainGrid_B05_200707.he2","r")
rrland = cdf_file->RrLandRain_MonthlyRainTotal_GeoGrid(:,:)
rrland@_FillValue = -1

resources = True
xwks = gsn_open_wks("pdf","AE_RnGd.hdfeos2")
plot = gsn_csm_contour_map_ce(xwks,rrland,resources)
end

Due to name mangling, this code uses the mangled name, RrLandRain_MonthlyRainTotal_GeoGrid to access the data field RrLandRain in the grid MonthlyRainTotal_GeoGrid. Since this field does not have an attribute that specifies the fill value, this code informs the fill value to draw a more meaningful plot.

gsn_csm_contour_map_ce() draws a contour plot over a cylindrical equidistant map. With several additional resource settings to specify NCL plot options, we could get the result shown in Figure 5. The full code is provided in Appendix 5.3.

4.3.3.3. Visualize a NetCDF-4 Classic Model-compliant HDF5 File that has 1-D Coordinate Variables

If an HDF5 file is netCDF-4 classic model-compliant, one can use NCL to visualize data.

Figure 6 NCL code to read and plot an HDF5 dataset from a netCDF-4 classic model-compliant HDF5 file
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
cdf_file = addfile("AMSR_E_L3_RainGrid_B05_200707_flatten.nc","r")
rrland = cdf_file->RrLandRain(:,:)
rrland@_FillValue = -1

resources = True
xwks = gsn_open_wks("pdf","AE_RnGd.netcdf4")
plot = gsn_csm_contour_map_ce(xwks,rrland,resources)
end
Figure 6 is almost the same as Figure 4 regardless of the file formats. The result is the same as Figure 5. For more information about the netCDF-4 classic model-compliant HDF5 file, refer to Appendix 5.1.

4.3.3.4. Visualize an HDF-EOS2 File that has 2-D Coordinate Variables

As we mentioned in Section 3.3, this file uses the north polar stereographic projection that requires two-dimensional longitude and latitude. This projection requires additional effort.

Figure 7 NCL code using two-dimensional longitude and latitude in an HDF-EOS2 file
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
cdf_file = addfile("AMSR_E_L3_SeaIce12km_B02_20020619.he2", "r")
nh18vday = cdf_file->SI_12km_NH_18V_DAY_NpPolarGrid12km(:,:)
nh18vday@lon2d = cdf_file->GridLon_NpPolarGrid12km
nh18vday@lat2d = cdf_file->GridLat_NpPolarGrid12km

xwks = gsn_open_wks("pdf","AE_SI12.north.dailyavgt")
plot = gsn_csm_contour_map_polar(xwks,nh18vday,resources)
end

Note: As per Section 4.3.2 file the file, AMSR_E_L3_SeaIce12km_B02_20020619.he2 is derived by simply renaming the downloaded example data file. The variable resources is defined as per the unabridged code listing of Appendix 5.4.

SI_12km_NH_18V_DAY is an HDF-EOS2 data field defined in this file. GridLon_NpPolarGrid12km and GridLat_NpPolarGrid12km don't exist in the file, but NCL generates both of these two-dimensional geolocation fields, which represent longitude and latitude. Since NCL does not automatically associate SI_12km_NH_18V_DAY with these two geolocation fields, users should specify the associations with statements, starting with nh18vday@lat2d and nh18vday@lon2d. NCL will recognize the lat2d and lon2d attributes and associate the data variable with geolocation variables.

gsn_csm_contour_map_polar() draws a plot over a polar stereographic map, as shown in Figure 8. The unabridged code is explained in Appendix 5.4.

4.3.3.5. Visualize a NetCDF-4 Classic Model-compliant HDF5 File that has 2-D Coordinate Variables

This section explains how to draw a plot when an HDF5 file has two-dimensional longitude and latitude. To accomplish this, the file must have two additional datasets representing longitude and latitude. In Figure 9, lon and lat are variables containing real coordinate values.

Figure 9 NCL code using two-dimensional longitude and latitude in a netCDF-4 classic model-compliant HDF5 file
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
cdf_file = addfile("AMSR_E_L3_SeaIce12km_B02_20020619_flatten.nc", "r")
nh18vday = cdf_file->SI_12km_NH_18V_DAY(:,:)
nh18vday@lat2d = cdf_file->lat
nh18vday@lon2d = cdf_file->lon

xwks = gsn_open_wks("pdf","AE_SI12.north.dailyavgt")
plot = gsn_csm_contour_map_polar(xwks,nh18vday,resources)
end
Basically, Figure 9 is the same as Figure 7 except that the code in Figure 9 uses both lon and lat, which exist in the HDF5 file. The data variable and the two coordinate variables should have the same number of elements because coordinate variables provide longitude and latitude for each element in the data variable. Since we can provide arbitrary longitude and latitude values with this method, we believe that NCL can draw a plot from all kinds of projections.

5. Appendix

5.1. NetCDF-4 Classic Model-compliant HDF5 File

Although NCL does not support HDF5, it does support the netCDF-4 classic model. This subsection explains what the netCDF-4 classic model-compliant HDF5 file is and how to get it from an HDF5 file.

A netCDF-4 classic model-compliant HDF5 file strictly follows the netCDF-3 data model. It has three requirements. The first requirement is that each dimension of an HDF5 dataset associated with a dimension dataset and the dimension should be located under the same or ancestor groups of the HDF5 dataset it is associated with. For this reason, a netCDF-4 classic model-compliant HDF5 file is a netCDF-4-compliant HDF5 file. The second requirement is that all HDF5 datasets should be defined only under the HDF5 root group. The third one is that all HDF5 datatypes should be HDF5 atomic datatypes.

Most netCDF-4-compliant HDF5 files contain several groups, which causes them not to conform to the netCDF-4 classic model. Although it is tedious, it is not impossible to manually convert a netCDF-4-compliant HDF5 file with a non-classic model into one with a classic model.

One way to accomplish this is to use ncdump and ncgen, which are part of the netCDF-4 package. One can use ncdump to generate a text file from a netCDF-4 file, which is shown in Figure 10. With this text file, one can use any text editor to remove groups, as shown in Figure 11. One may also need to rename some variables if their names are used in multiple groups. Then, the modified text file can be used as input to ncgen, which generates a netCDF-4 file. The output of ncgen can be read by NCL.

Figure 10 Textual representation of a netCDF-4 file generated by ncdump
netcdf AMSR_E_L3_RainGrid_B05_200707 {
// global attributes:
:HDFEOSVersion_GLOSDS = "HDFEOS_V2.13" ;
group: MonthlyRainTotal_GeoGrid {
...
group: Data\ Fields {
dimensions:
lon = 72 ;
lat = 28 ;
variables:
float TbOceanRain(lat, lon) ;
TbOceanRain:HDF4_OBJECT_TYPE = "SDS" ;
TbOceanRain:HDF4_OBJECT_NAME = "TbOceanRain" ;
double lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
double lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
float RrLandRain(lat, lon) ;
RrLandRain:HDF4_OBJECT_TYPE = "SDS" ;
RrLandRain:HDF4_OBJECT_NAME = "RrLandRain" ;
...
}
}
Figure 11 Edited textual representation of a netCDF-4 file
netcdf AMSR_E_L3_RainGrid_B05_200707_flatten {
dimensions:
lon = 72 ;
lat = 28 ;
variables:
float TbOceanRain(lat, lon) ;
TbOceanRain:HDF4_OBJECT_TYPE = "SDS" ;
TbOceanRain:HDF4_OBJECT_NAME = "TbOceanRain" ;
double lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
double lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
float RrLandRain(lat, lon) ;
RrLandRain:HDF4_OBJECT_TYPE = "SDS" ;
RrLandRain:HDF4_OBJECT_NAME = "RrLandRain" ;
data:

TbOceanRain =
...
}

5.2. Visualize an HDF4 SDS with NCL

This code is an unabridged version of Figure 2. It reads and visualizes ocean wind fields in an HDF4 SDS.

Figure 12 NCL code to read and plot data from an HDF4 SDS
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
cdf_file = addfile("atlas.ssmi.ver02.level3.5_5day.s950103.hdf", "r")
u = cdf_file->u10m(0,:,:)
v = cdf_file->v10m(0,:,:)

xwks = gsn_open_wks("pdf","ssmi")

resources = True
resources@vcGlyphStyle = "CurlyVector"
resources@tiMainString = "Ocean Wind Fields at Jan 3, 1995"

; skip some data to prevent too dense vector
resources@vcRefLengthF = 0.05
resources@vcMinDistanceF = 0.015

resources@tiMainFont = 21
resources@tiXAxisFont = 21
resources@tiYAxisFont = 21
resources@lbLabelFont = 21
resources@tmXBLabelFont = 21
resources@tmYLLabelFont = 21
resources@tmXTLabelFont = 21
resources@gsnStringFont = 21

plot = gsn_csm_vector_map_ce(xwks,u,v,resources)

end

5.3. Visualize an HDF-EOS2 File with NCL that has 1-D Coordinate Variables

The following code is an unabridged version of Figure 4.

Figure 13 NCL code to read and plot grid data from an HDF-EOS2 file
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
cdf_file = addfile("AMSR_E_L3_RainGrid_B05_200707.he2","r")

tbocean = cdf_file->TbOceanRain_MonthlyRainTotal_GeoGrid(:,:)
tbocean@units = "Unit mm"
tbocean@_FillValue = -1
rrland = cdf_file->RrLandRain_MonthlyRainTotal_GeoGrid(:,:)
rrland@units = "Unit mm"
rrland@_FillValue = -1

xwks = gsn_open_wks("pdf","AE_RnGd.hdfeos2")

resources = True
resources@gsnDraw = False
resources@gsmFrame = False
resources@cnLinesOn = False
resources@cnFillOn = True
resources@cnMonoFillPattern = True
resources@cnMonoFillColor = False
resources@cnInfoLabelOn = False
resources@mpFillOn = False

resources@pmLabelBarDisplayMode = "Always"
resources@lbOrientation = "vertical"

resources@tiMainFont = 21
resources@tiXAxisFont = 21
resources@tiYAxisFont = 21
resources@lbLabelFont = 21
resources@tmXBLabelFont = 21
resources@tmYLLabelFont = 21
resources@tmXTLabelFont = 21
resources@gsnStringFont = 21
resources@tiMainFontHeightF = 0.015
resources@tiXAxisFontHeightF = 0.01
resources@tiYAxisFontHeightF = 0.01
resources@lbLabelFontHeightF = 0.01
resources@tmXBLabelFontHeightF = 0.01
resources@tmYLLabelFontHeightF = 0.01
resources@tmXTLabelFontHeightF = 0.01
resources@gsnStringFontHeightF = 0.01

resources@cnLevelSelectionMode = "ManualLevels"
resources@cnLevelSpacingF = 50
resources@cnMinLevelValF = 50
resources@cnMaxLevelValF = 600

resources@cnMissingValFillPattern = 0
resources@cnMissingValFillColor = 17

; define color map
cmap = (/ (/360.,0.,1./),(/360.,0.,0./), \
(/220, 0.05, 1.0/), (/220, 0.2, 1.0/), \
(/220, 0.3, 1.0/), (/220, 0.4, 1.0/), \
(/220, 0.5, 1.0/), (/220, 0.6, 1.0/), \
(/220, 0.7, 1.0/), (/220, 0.8, 0.9/), \
(/220, 0.8, 0.8/), (/220, 0.8, 0.7/), \
(/220, 0.8, 0.6/), (/220, 0.8, 0.5/), \
(/220, 0.8, 0.4/), (/220, 0.8, 0.3/), \
(/220, 0.9, 0.2/), (/60, 0.3, 1.0/) /)
rgbcmap = hsvrgb(cmap)
gsn_define_colormap(xwks,rgbcmap)

; Brightness temperature derived monthly rain total over ocean
resources@tiMainString = "AE_RnGd.he2 - Total Rain Rate over Ocean in July 2007"
plot = gsn_csm_contour_map_ce(xwks,tbocean,resources)

; create label bar for fill value
lbres = True
lbBoxCount = 1
lbres@vpWidthF = 0.15
lbres@vpHeightF = 0.04
lbres@lbBoxMajorExtentF = 0.60
lbres@lbFillColors = hsvrgb((/ (/60, 0.3, 1.0/), (/60, 0.3, 1.0/) /))
lbres@lbMonoFillPattern = True
lbres@lbLabelFont = 21
lbres@lbLabelFontHeightF = 0.04
lbres@lbLabelJust = "CenterLeft"
lbid = gsn_create_labelbar(xwks,1,(/"fill value"/),lbres)

; draw annotation containing label bar
amres = True
amres@amJust = "TopRight"
amres@amParallelPosF =0.5
amres@amOrthogonalPosF = -0.5
annoid = gsn_add_annotation(plot,lbid,amres)

draw(plot)
frame(xwks)

; Rain rate derived monthly rain total over land
resources@tiMainString = "AE_RnGd.he2 - Total Rain Rate over Land in July 2007"
plot = gsn_csm_contour_map_ce(xwks,rrland,resources)

annoid = gsn_add_annotation(plot,lbid,amres)

draw(plot)
frame(xwks)

end

5.4. Visualize an HDF-EOS2 File with NCL that has 2-D Coordinate Variables

The following code is an unabridged version of Figure 7.

Figure 14 NCL code using two-dimensional longitude and latitude in an HDF-EOS2 file
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

cdf_file = addfile("AMSR_E_L3_SeaIce12km_B02_20020619.he2", "r")

nh18vday = cdf_file->SI_12km_NH_18V_DAY_NpPolarGrid12km(:,:)
nh18vday@lon2d = cdf_file->GridLon_NpPolarGrid12km
nh18vday@lat2d = cdf_file->GridLat_NpPolarGrid12km
nh18vday@unit = "K"

xwks = gsn_open_wks("pdf","AE_SI12.north.dailyavgt.hdfeos2")

setvalues NhlGetWorkspaceObjectId()
"wsMaximumSize" : 500000000
end setvalues

resources = True

gsn_define_colormap(xwks,"wgne15")

resources@gsnPolar = "NH"
resources@mpMinLatF = 30
resources@mpFillOn = False
resources@cnFillOn = True
resources@cnLinesOn = False
resources@gsnSpreadColors = True
resources@gsnSpreadColorStart = 2
resources@gsnSpreadColorEnd = -3

resources@tiMainString = "18.7 GHz vertical, daily average Tb (x10) at June 19 2002"

; [1625, ..., 3058] 4186 fillers
resources@cnLevelSelectionMode = "ManualLevels"
resources@cnLevelSpacingF = 200
resources@cnMinLevelValF = 1500
resources@cnMaxLevelValF = 3500
plot = gsn_csm_contour_map_polar(xwks,nh18vday,resources)


end

6 Additional Examples

7. References


Last modified: 11/11/2020
About Us | Contact Info | Archive Info | Disclaimer
Sponsored by Subcontract number 4400528183 under Raytheon Contract number NNG15HZ39C, funded by NASA / Maintained by The HDF Group