netcdf_opts: Set Options for Reading NetCDF files

View source: R/netcdf_opts.R

netcdf_optsR Documentation

Set Options for Reading NetCDF files

Description

When reading NetCDF files in harp, the system needs to know some information about the structure of the NetCDF files. In order to get the domain information it needs to know about the projection and the location of the domain and in order to read the correct data it needs to know the names and order of the dimensions.

Usage

netcdf_opts(
  options_set = c("none", "met_norway_eps", "met_norway_det", "met_norway_ifsens",
    "met_norway_ifshires", "wrf", "wrf_u_stagger", "wrf_v_stagger"),
  param_find = list(),
  proj4_var = "projection_lambert",
  proj4_att = "proj4",
  proj4 = NULL,
  x_dim = "x",
  y_dim = "y",
  lon_var = "longitude",
  lat_var = "latitude",
  x_rev = FALSE,
  y_rev = FALSE,
  dx = NULL,
  dy = NULL,
  z_var = NA,
  member_var = NA,
  time_var = "time",
  ref_time_var = NA,
  force_param_name = FALSE
)

Arguments

options_set

A set of pre-defined options that can be returned. Currently only available for data at MET Norway.

param_find

A list used to map parameter name to the name of the variable in in the NetCDF file. The name should be the parameter name used in the read function and the element should be the name in the NetCDF file.

proj4_var

The variable that holds the projection information in the NetCDF files. Set to 0 if the proj4 string is a global attribute.

proj4_att

The attribute of proj4_var that holds the proj4 string.

proj4

If the proj4 string is not available from the NetCDF files it can be set here. Set to "wrf" to get the proj4 string from WRF output files. Note that if proj4 = NULL then an attempt will be made to get the proj4 string from proj4_var and proj4_att. If proj4 has any value other than NULL, proj4_var and proj4_att will be ignored.

x_dim

The name of the x dimension.

y_dim

The name of the y dimension.

lon_var

The name of the longitude dimension. This is needed to get the southwest and northeast corners of the domain. Set to NULL if not available and an attempt to will be made to get the corners from x_dim and y_dim and the projection information.

lat_var

The name of the latitude dimension. This is needed to get the southwest and northeast corners of the domain. Set to NULL if not available and an attempt to will be made to get the corners from x_dim and y_dim and the projection information.

x_rev

Set to TRUE if data in the x direction are in reverse order.

y_rev

Set to TRUE if data in the y direction are in reverse order.

dx

The x resolution of the data. This needs to be set if the x dimension in the file is not a netcdf dimvar.

dy

The y resolution of the data. This needs to be set if the y dimension in the file is not a netcdf dimvar.

z_var

The name of the z (vertical) dimension.

member_var

The name of the ensemble member dimension.

time_var

The name of the time dimension.

ref_time_var

The name of the variable holding the forecast reference time. Set to NA if it is to be derived from the first value in the time dimension.

force_param_name

Logical. Set to TRUE to force harp to look for the exact parameter name as passed rather than to use a lookup table.

Details

Note that the order of the dimensions is "Fortran order" rather than "C" order. This means that the order of the dimensions is obtained by reading from right to left in the output of ncdump -h .

The default options can be seen by running netcdf_opts(), but there are also some options sets that can be selected, currently only those for data held at MET Norway and WRF output files.

Value

A list of options for reading netcdf files.

Examples

netcdf_opts()
netcdf_opts(options_set = "met_norway_eps")
netcdf_opts(options_set = "met_norway_ifsens")
netcdf_opts(
  member_var = "ensemble_member",
  z_var      = "pressure"
)

andrew-MET/harpIO documentation built on March 7, 2024, 7:48 p.m.