wiki:TwoDimensionalCoordinateAxes

Displaying data that use two-dimensional coordinate axes

NOTE: this information is now redundant; as of 1.0RC1, ncWMS now works with two-dimensional coordinate axes without modification. This page is kept for users still running old versions

Intro

ncWMS will usually work "out of the box" with NetCDF data that are expressed using a well-known coordinate system (for example, latitude-longitude, Lambert Equal-Area). However, many numerical models use more unusual grids. These are expressed in the NetCDF file using  two-dimensional horizontal coordinate axes. This presents a problem for ncWMS as there is no simple mapping from latitude-longitude to the nearest [i,j] indices in the data array.

There are two solutions to this problem. The current solution employed in ncWMS is based upon pre-generated look-up tables (LUTs) that contain a pre-calculated mapping from a finite set of [lat,lon] pairs to [i,j]. Instructions for the generation and installation of these LUTs is given below. Future versions of ncWMS will employ a more user-friendly solution which requires no special configuration. This is currently under development.

Generation of look-up tables

The look-up table creater (LUT_Creator.tar.gz) is a FORTRAN program that can be downloaded from the link at the bottom of this page. It is fairly simple to use, and no modifications to the code should be necessary. It requires two input files in NetCDF format to work. The first is a file containing the grid coordinates (e.g. lat/lon), and the second an optional file with a land-sea mask. All filenames and names of dimensions and arrays are specified in the namelist file. The namelist_TEMPLATE file contains more detailed comments about what's required. An example Makefile is also included.

To use:

  1. Set the compiler options and path to the NetCDF libraries in 'Makefile'
  2. Compile
  3. Specify the path and name of the coordinates and mask file in the namelist
  4. Specify the names of dimensions and arrays from the netcdf files in the namelist.
  5. Choose a domain and gridsize for the lookup table in the namelist section 'ncalc'
    • 5.1 define a bounding box using a max/min lat and lon to cover the model grid domain
    • 5.2 specify how many points per degree of lat and lon you want. E.g. for a 1/4 degree model, 12 points is good.
  6. Execute!

Installing the look-up tables in ncWMS

Installing the LUTs into ncWMS requires some Java coding. You need to create a subclass of DataReader that knows that it must read the LUTs in order to interpret the coordinate axes. The easiest way to do this is probably to copy and edit an existing such class, such as the ROMS data reader. Having compiled the class, you must place this into the ncWMS class hierarchy and restart your application server. When you add the dataset using the ncWMS admin web page, you must provide the full class name of your data-reading class.

These instructions are very brief, but will hopefully be made redundant by future improved versions of ncWMS. If you have trouble please don't hesitate to ask for help on the ncwms-users mailing list. We know that this system is far from ideal and are working to improve it.

Attachments