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 fromproj4_var
andproj4_att
. If proj4 has any value other than NULL,proj4_var
andproj4_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.
Examples
netcdf_opts()
#> $options_set
#> [1] "none"
#>
#> $param_find
#> list()
#>
#> $proj4_var
#> [1] "projection_lambert"
#>
#> $proj4_att
#> [1] "proj4"
#>
#> $proj4
#> NULL
#>
#> $x_dim
#> [1] "x"
#>
#> $y_dim
#> [1] "y"
#>
#> $lon_var
#> [1] "longitude"
#>
#> $lat_var
#> [1] "latitude"
#>
#> $x_rev
#> [1] FALSE
#>
#> $y_rev
#> [1] FALSE
#>
#> $dx
#> NULL
#>
#> $dy
#> NULL
#>
#> $z_var
#> [1] NA
#>
#> $member_var
#> [1] NA
#>
#> $time_var
#> [1] "time"
#>
#> $ref_time_var
#> [1] NA
#>
#> $force_param_name
#> [1] FALSE
#>
netcdf_opts(options_set = "met_norway_eps")
#> $options_set
#> [1] "met_norway_eps"
#>
#> $param_find
#> list()
#>
#> $proj4_var
#> [1] "projection_lambert"
#>
#> $proj4_att
#> [1] "proj4"
#>
#> $proj4
#> NULL
#>
#> $x_dim
#> [1] "x"
#>
#> $y_dim
#> [1] "y"
#>
#> $lon_var
#> [1] "longitude"
#>
#> $lat_var
#> [1] "latitude"
#>
#> $x_rev
#> [1] FALSE
#>
#> $y_rev
#> [1] FALSE
#>
#> $dx
#> NULL
#>
#> $dy
#> NULL
#>
#> $z_var
#> [1] "height1"
#>
#> $member_var
#> [1] "ensemble_member"
#>
#> $time_var
#> [1] "time"
#>
#> $ref_time_var
#> [1] "forecast_reference_time"
#>
#> $force_param_name
#> [1] FALSE
#>
netcdf_opts(options_set = "met_norway_ifsens")
#> $options_set
#> [1] "met_norway_ifsens"
#>
#> $param_find
#> list()
#>
#> $proj4_var
#> [1] "projection_regular_ll"
#>
#> $proj4_att
#> [1] "proj4"
#>
#> $proj4
#> NULL
#>
#> $x_dim
#> [1] "longitude"
#>
#> $y_dim
#> [1] "latitude"
#>
#> $lon_var
#> [1] "longitude"
#>
#> $lat_var
#> [1] "latitude"
#>
#> $x_rev
#> [1] FALSE
#>
#> $y_rev
#> [1] TRUE
#>
#> $dx
#> NULL
#>
#> $dy
#> NULL
#>
#> $z_var
#> [1] "surface"
#>
#> $member_var
#> [1] "ensemble_member"
#>
#> $time_var
#> [1] "time"
#>
#> $ref_time_var
#> [1] "forecast_reference_time"
#>
#> $force_param_name
#> [1] FALSE
#>
netcdf_opts(
member_var = "ensemble_member",
z_var = "pressure"
)
#> $options_set
#> [1] "none"
#>
#> $param_find
#> list()
#>
#> $proj4_var
#> [1] "projection_lambert"
#>
#> $proj4_att
#> [1] "proj4"
#>
#> $proj4
#> NULL
#>
#> $x_dim
#> [1] "x"
#>
#> $y_dim
#> [1] "y"
#>
#> $lon_var
#> [1] "longitude"
#>
#> $lat_var
#> [1] "latitude"
#>
#> $x_rev
#> [1] FALSE
#>
#> $y_rev
#> [1] FALSE
#>
#> $dx
#> NULL
#>
#> $dy
#> NULL
#>
#> $z_var
#> [1] "pressure"
#>
#> $member_var
#> [1] "ensemble_member"
#>
#> $time_var
#> [1] "time"
#>
#> $ref_time_var
#> [1] NA
#>
#> $force_param_name
#> [1] FALSE
#>