Re: netcdf output: defining co-ordinate arrays for multiple dimensions

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 01 2014 - 16:34:57 MDT

Hi Chris,
Ideally you will want to follow the CF conventions for creating your NetCDF file. Unfortunately the regular CF convention website is down right now so I cannot point you to it.
But you can get it at this URL: https://github.com/cf-convention/cf-documents/blob/master/cf-conventions/1.6/cf-conventions.pdf?raw=true

The section on 2-D lat/lon coordinates gives this example:

Example 5.2. Two-dimensional coordinate variables

dimensions:
  xc = 128 ;
  yc = 64 ;
  lev = 18 ;

variables:

  float T(lev,yc,xc) ;
    T:long_name = "temperature" ;
    T:units = "K" ;
    T:coordinates = "lon lat" ;

  float xc(xc) ;
    xc:axis = "X" ;
    xc:long_name = "x-coordinate in Cartesian system" ;
    xc:units = "m" ;

  float yc(yc) ;
    yc:axis = "Y" ;
    yc:long_name = "y-coordinate in Cartesian system" ;
    yc:units = "m" ;

  float lev(lev) ;
    lev:long_name = "pressure level" ;
    lev:units = "hPa" ;

  float lon(yc,xc) ;
    lon:long_name = "longitude" ;
    lon:units = "degrees_east" ;

  float lat(yc,xc) ;
    lat:long_name = "latitude" ;
    lat:units = "degrees_north" ;

=======

The data variable T and the lat and lon variables have the same 2 rightmost dimensions which are often just index dimensions without a coordinate
variable. In this example cartesian 1D coordinates are supplied in meters, but they are not necessary for CF-compliance. The main point here is that a "coordinates"
attribute is attached to the data variable that points to the lat and lon variables used as coordinates.

Hope this helps,
 -dave

On Apr 1, 2014, at 7:47 AM, Christopher Steele (ENV) <Christopher.Steele@uea.ac.uk> wrote:

> Hi everyone,
>
> I'm trying to create an output in netcdf for variables which are on a Lambert Conformal projection. The trouble is, from looking at the documentation, I'm not sure how to define a variable so that it has coordinates lat and lon only (where lat and lon are 2D). Does anyone have any ideas as to how I go about achieving this?
>
> cheers
>
> Chris
>
>
>
>
> Christopher Steele,
> Academic Researcher,
> Centre for Ocean and Atmospheric Sciences,
> School of Environmental Sciences,
> University of East Anglia,
> Norwich,
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 1 16:35:09 2014

This archive was generated by hypermail 2.1.8 : Thu Apr 03 2014 - 13:36:27 MDT