Skip to content

Basic Tutorial

Chris Wynnyk edited this page Jun 21, 2013 · 25 revisions

This tutorial covers how to get started with loading, analyzing, and visualizing data.

Table of Contents

Wind Plot

Background

Forecast products from NOAA are often stored in a compressed binary format for scientific data, such as Netcdf, Grib, or Grib2. Unidata publishes the Java-Netcdf toolbox that provides a Java API for extracting and slicing data along with corresponding meta-data. Additionally, the nctoolbox project provides an open source, lightweight Matlab wrapper around the Java-Netcdf libraries.

The Atmospheric Toolbox extends these projects, providing additional capabilities specific to atmospheric data analysis. These capabilities include:

  • Analysis

  • Interpolation over non-uniform grids

  • Vertical and lateral transformations

  • Intuitive, class-based access to variables and parameters

  • Visualization

  • Simple methods for quick plotting

  • Transparency overlay

  • Wind vector rendering

  • Animation

Load Data

First, download and install the atmospheric and sampleData projects.

Atmospheric class provides access to the data. For example:

filename = AtmoSampleData.rapHybrid13km;
a = Atmospheric(filename)   

Returns your file as an Atmospheric object:

>>    a = Atmospheric handle
>>
>>     Properties:
>>                     product: 'rap'
>>                forecastDate: 7.3539e+05
>>             forecastOutlook: 0
>>           verticalCoordSys: 'Hybrid'
>>             verticalLevels: 50
>>                  variables: {69x1 cell}
>>            variablesLoaded: {'hybrid'}
>>    windsAlignedToTrueNorth: 0
>>                   latitude: [337x451 single]
>>                  longitude: [337x451 single]
>>              projectedDate: 7.3539e+05
>>                     hybrid: [50x1 single]

From the properties, the forecast is a Rapid Refresh file, with a 50-level hybrid vertical coordinate system.

Let's verify that we loaded the correct date:

datestr(a.forecastDate)

>>  ans = 02-Jun-2013 19:00:00

The forecast contains 69 variables, which are listed as a cell array:

a.variables

>> ans = 
>>     'baseflowGroundwaterRunoffSurface0HourAccumulation'
>>     'canopyWaterEvaporationSurface'
>>     'cloudIceHybrid'
>>     'cloudMixingRatioHybrid'
>>     'convectiveAvailablePotentialEnergyPressureDifferenceLayer'
>>     ...
>>     'windSpeedGustSurface'
>>     'x'
>>     'y'

Call the load function to load any of these variables:

a.load({'cloudIceHybrid','pressureTropopause','temperatureSurface'})

>> ans = 
>>   Atmospheric handle
>> 
>>   Properties:
>>                     product: 'rap'
>>                forecastDate: 7.3539e+05
>>             forecastOutlook: 0
>>            verticalCoordSys: 'Hybrid'
>>              verticalLevels: 50
>>                   variables: {69x1 cell}
>>             variablesLoaded: {4x1 cell}
>>     windsAlignedToTrueNorth: 0
>>                    latitude: [337x451 single]
>>                   longitude: [337x451 single]
>>               projectedDate: 7.3539e+05
>>              cloudIceHybrid: [50x337x451 single]
>>                      hybrid: [50x1 single]
>>          temperatureSurface: [337x451 single]
>>          pressureTropopause: [337x451 single]

Each variable is loaded and stored in an associated dynamic property. For example, we see cloudIceHybrid is a 3D grid (50x337x451), temperatureSurface is 2D (337x451). The data is directly accessible:

mean(a.temperatureSurface(:))  % In Kelvins

>> ans = 297.261

size(a.temperatureSurface)

>> ans = 337   451

For complete documentation on the Atmospheric.load function, type doc Atmospheric.load.

Visualization

We can plot any of the loaded variables. By default, the Atmospheric.plot() displays a single vertical level of wind from approximately the 300 mb level. Note that the first call will be slow if the variables are not already loaded.

The plot() function accepts the following (parameter, value) argument pairs:

  • 'variable' - String - Variable
  • 'level' - Integer - Vertical level
  • 'colormap' - String or colormap array, such as 'blue', or jet
  • 'alpha' - Double - Alpha blending factor, 0.0 to 1.0

These argument pairs are accepted in any order to provide flexible plotting capabilities. Type doc Atmospheric.plot for the latest complete list of plotting options, along with default values.

The examples below show various plotting techniques.

Winds
a = Atmospheric(AtmoSampleData.rapHybrid13km)   
a.plot();

Wind Plot

Winds (Isobaric Level 33)
a = Atmospheric(AtmoSampleData.rapHybrid13km)   
a.plot('level',33);

Wind Plot Level 33

Temperature
a = Atmospheric(AtmoSampleData.gfsHighresIsobaric);
a.plot('variable','temperatureSurface','colormap',jet);

Global Temperatures

Ozone
a = Atmospheric(AtmoSampleData.gfsHighresIsobaric);
a.plot('variable','totalOzoneEntireAtmosphere','colormap','cool);

Ozone Coverage

Ice
a = Atmospheric(AtmoSampleData.gfsHighresIsobaric);
a.plot('variable','iceCoverSurface','colormap',bone)

Ice Coverage

Reflectivity
a = Atmospheric(AtmoSampleData.rapIsobaric13km);
% Note - we manually add white (1,1,1) to the top of the jet colormap.
a.plot('variable','compositeReflectivityEntireAtmosphere','colormap',[1 1 1; jet(40)])

Reflectivity

Altitude

This plot shows the surface geopotential altitude associated with the GFS model.

a = Atmospheric(AtmoSampleData.gfsHighresIsobaric);
a.plot('variable','geopotentialHeightSurface','colormap',landcolor);

Geopotential Surface

Clone this wiki locally