ATOMIX - NetCDF file creation

Benchmark example

Created by Cynthia Bluteau for SCOR WG160 members

Table of content

Structure of a NetCDF file with groups

Benchmark example

Variables & Dimensions also have attributes (metadata)

Global attributes: "Title", "Author", "Instrument", etc

Benchmark example

Group attributes: "Processing_level", "Comment", any other notes about the group (e.g., Level1_raw)

Structure of ADV Level 1 Group

Benchmark example
  • Dimensions specify the size/shape of Variables
  • Both have attributes (metadata)

Dimensions defined for the group level

Example for Level 1 (ADVs) XYZ_VEL example

NetCDF Writing Toolbox

  • This NetCDF toolbox relies on low-level netcdf functions in Matlab (feel free to use your own).
  • YAML files contain boiler plate metadata information -- useful even if you use other NetCDF writing tools

Visual summary

ALT:Netcdf summary image

NetCDF toolbox set-up

  1. Each group are stored in matlab structures
    • Each fields corresponds to the desired short_name (e.g., PRES, TIME)
  2. Global and group metadata are stored in YAML files
    • Dimensions are specified via the YAML file(s)
  3. Variables/dimensions attributes set from CSV database lookup using the short_names (i.e., fields in each matlab structure)
  4. Additional variable attributes can be set from YAML flag files

Prepare your data

IMG:Matlab output for structure
Each group are stored in Matlab structures

Designating dimensions variable

IMG:Matlab output for structure
In both cases, the code uses variable sizes to assign the correct dimensions ...

Assigning dimensions at the variable level

IMG:Example assigning dim at the variable level

If more than 1 dimension variable has the same size, then dimensions must be defined for EACH variable using the YAML flag files

Example of Variables & Dimensions Attributes

Example attributes

Check Variables & Dimensions Attributes

Attributes are stored in CSV databases, some are transfered from the wiki and/or atomix_netcdf.xlsx on teams.

These should remain fairly constant for everyone, but you can modify attributes by creating

YAML files supply group and global attributes


Benchmark example
This YAML tutorial explains more the format, which uses spaces (no tabs) to organise information

Prepare Global Attributes

Prepare Group Attributes

Example YAML for supplying ADV's group attributes
IMG: Example group yaml

Quality control flags

Variables with "_FLAGS" appended have extra attributes "flag_meanings" and "flag_values" as per CF standards. For example:

  • XYZ_VEL contains velocity data
  • XYZ_VEL_FLAGS contains 8-bit boolean flags to designate rejection reasons for velocity samples (low correlation, obstructions, etc)

See YAML file example for creating these attributes

Two CF-compliant flag types

Boolean Enumerated
Values 0-255 0-9
DataType 8 bytes 10 integer
Enables multiple criteria/flags met at once Only 1 criteria can be met

YAML files specifies the additional flag attributes

Example attributes
Should remain fairly constant for a subgroup.

Running the tools, and checking your file

Example panoply