En:using ww3 output:reading nc grid

De WAVEWATCH-III Wiki

Generalities

NetCDF files are very generic and allow a self-explanatory storage of the data. See [ http://www.unidata.ucar.edu/software/netcdf/ ]. The first thing you may want to do with a NetCDF file (usually named *.nc ) is to get a look at what it contains. On UNIX / LINUX systems you may do this with the ncdump command, using something like

 ncdump -h myfile.nc 

will display the header (name of dimensions and variables, attributes ...) of the file myfile.nc . You may also want to play with NetCDF files by concatenating them, extracting only part of the data ... for this look for the ncks toolbox.

The way we used NetCDF in WAVEWATCH III is rather straightforward. Gridded data on regular lat/lon grids have dimensions longitude, latitude and time. In order to save space, some of the variables are stored as 2-byte short integers, this is typically the case of the significant wave height hs. The matlab scripts provided here take care of this.

All the necessary files for a first test can be found at this ftp address: http://tinyurl.com/iowagaftp/iowaga/SISMO/TUTORIALS/ where you can find a big tar-ball READING_PLOTTING.tar.gz (1.3 Gb: this is due to the seismic source files), or you can pick the different bits and pieces separately in the directory READING_GRIDDED_DATA in [ http://tinyurl.com/iowagaftp/iowaga/SISMO/TUTORIALS/READING_GRIDDED_DATA/ ]

Let's have a go: data from regular grids, e.g. the IOWAGA global model

For example, run the the script example_plot_rect.m It will read the hs variable from the file ww3.200803_hs.nc (which was copied from http://tinyurl.com/iowagaftp/HINDCAST/GLOBAL/2008_ECMWF/hs/ ) and plots one given time step.

More details

In addition the the information that you really nead to plot the data, the NetCDF file also contains other useful information:

  • the status map MAPSTA : this array informs on the status of the node: active / excluded / wet. Where MAPSTA = 1, these are the "active points" where the wave action equation is actually integrated in time. Where MAPSTA = 0, these are land points. Where MAPSTA = 2, these are "boundary forcing nodes" where the spectrum is simply copied from the nest.ww3 file or passed on from a higher rank grid (in the case of multigrid runs). Where MAPSTA = 8, these are excluded nodes. If you are using data from different grids and want to merge them, then the MAPSTA information can be useful.
  • switches :