write2ncdf4.dsensemble: Saves climate data as netCDF.

View source: R/write2ncdf4.dsensemble.R

write2ncdf4.dsensembleR Documentation

Saves climate data as netCDF.

Description

Method to save station data as netCDF, making sure to include the data structure and meta-data (attributes). The code tries to follow the netCDF 'CF' convention. The method is built on the ncdf4 package.

Usage

## S3 method for class 'dsensemble'
write2ncdf4(
  x,
  ...,
  file = NULL,
  path = NULL,
  force = TRUE,
  prec = "short",
  offset = 0,
  scale = 0.1,
  type = "dsensemble",
  im = NULL,
  is = NULL,
  it = NULL,
  torg = "1970-01-01",
  missval = -999,
  method = "metnoESD",
  region = NULL,
  ensemblename = NULL,
  conventions = "ACDD-1.3",
  id = NA,
  naming_authority = NA,
  source = NA,
  processing_level = "Scientific",
  comment = NA,
  acknowledgement = NA,
  license = "Freely distributed",
  standard_name_vocabulary = "CF Standard Name Table v27",
  creator_name = NA,
  creator_email = NA,
  creator_url = NA,
  creator_institution = NA,
  creator_type = NA,
  institution = NA,
  institution_short_name = NA,
  project = NA,
  project_short_name = NA,
  publisher_name = NA,
  publisher_email = NA,
  publisher_url = NA,
  publisher_type = NA,
  publisher_institution = NA,
  product_version = NA,
  summary = NA,
  keywords = NA,
  keywords_vocabulary =
    "GCMDSK:GCMD Science Keywords:https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/sciencekeywords, GCMDPROV:GCMD",
  references = NA,
  title = NA,
  title_no = NA,
  additional_attributes = NA,
  verbose = FALSE
)

Arguments

x

a 'dsensemble' object containing empirically-statistically downscaled results (output from 'DSensemble')

...

additional arguments

file

name of output file

path

path to output file

force

If TRUE (default), overwrite existing files. If FALSE, do not write data to a file if there is already one with the same file name.

prec

Precision: see ncvar_def

offset

Sets the attribute 'add_offset' which is added to the values stored (to save space may be represented as 'short').

scale

Sets the attribute 'scale_factor' which is used to scale (multiply) the values stored (to save space may be represented as 'short').

type

a vector defining the type of data to write to the netCDF file. The default type is "dsensemble" which writes dsensemble data in its original form. Other options are "ensemblestatistics" to calculate and write ensemble statistics, or "model" which writes downscaled results for a single model simulation (the ensemble member is then selected with the input argument 'im'). The options 'ensemblestatistics' and 'model' can be used in conjunction with the additional argument, e.g. c('model','field') or c('model','station') to save the downscaled results as a field (gridded data) or a 'station' object (the stations that were used as predictand in the downscaling).

im

a numerical or numerical vector with indices of the ensemble members to be included. If NULL include all.

torg

Time origin

missval

Missing value: see ncvar_def

region

Name of the region of the downscaled data, if not NULL (which is the default) used in the filename that is generated if file is not specified.

ensemblename

Name of the ensemble - goes into the filename that is generated if file is not specified. The default is NULL and the ensemble name does not have to be set unless a subset of models are selected (e.g., with the input im).

id

An identifier for the data set, provided by and unique within its naming authority. The combination of the "naming authority" and the "id" should be globally unique, but the id can be globally unique by itself also. IDs can be URLs, URNs, DOIs, meaningful text strings, a local key, or any other unique string of characters. The id should not include white space characters.

naming_authority

The organization that provides the initial id (see above) for the dataset. The naming authority should be uniquely specified by this attribute. We recommend using reverse-DNS naming for the naming authority; URIs are also acceptable. Example: 'edu.ucar.unidata'.

source

The method of production of the original data. If it was model-generated, source should name the model and its version. If it is observational, source should characterize it. This attribute is defined in the CF Conventions. Examples: 'temperature from CTD #1234'; 'world model v.0.1'.

processing_level

A textual description of the processing (or quality control) level of the data.

comment

Miscellaneous information about the data, not captured elsewhere. This attribute is defined in the CF Conventions.

acknowledgement

A place to acknowledge various types of support for the project that produced this data.

license

Provide the URL to a standard or specific license, enter "Freely Distributed" or "None", or describe any restrictions to data access and distribution in free text.

standard_name_vocabulary

The name and version of the controlled vocabulary from which variable standard names are taken. (Values for any standard_name attribute must come from the CF Standard Names vocabulary for the data file or product to comply with CF.) Example: 'CF Standard Name Table v27'.

creator_name

The name of the person (or other creator type specified by the creator_type attribute) principally responsible for creating this data.

creator_email

The email address of the person (or other creator type specified by the creator_type attribute) principally responsible for creating this data.

creator_url

The URL of the person (or other creator type specified by the creator_type attribute) principally responsible for creating this data.

creator_institution

The institution of the creator; should uniquely identify the creator's institution. This attribute's value should be specified even if it matches the value of publisher_institution, or if creator_type is institution.

creator_type

Specifies type of creator with one of the following: 'person', 'group', 'institution', or 'position'. If this attribute is not specified, the creator is assumed to be a person.

institution

The name of the institution principally responsible for originating this data. This attribute is recommended by the CF convention.

project

The name of the project(s) principally responsible for originating this data. Multiple projects can be separated by commas, as described under Attribute Content Guidelines. Examples: 'PATMOS-X', 'Extended Continental Shelf Project'.

publisher_name

The name of the person (or other entity specified by the publisher_type attribute) responsible for publishing the data file or product to users, with its current metadata and format.

publisher_email

The email address of the person (or other entity specified by the publisher_type attribute) responsible for publishing the data file or product to users, with its current metadata and format.

publisher_url

The URL of the person (or other entity specified by the publisher_type attribute) responsible for publishing the data file or product to users, with its current metadata and format.

publisher_type

Specifies type of publisher with one of the following: 'person', 'group', 'institution', or 'position'. If this attribute is not specified, the publisher is assumed to be a person.

publisher_institution

The institution that presented the data file or equivalent product to users; should uniquely identify the institution. If publisher_type is institution, this should have the same value as publisher_name.

product_version

Version identifier of the data file or product as assigned by the data creator. For example, a new algorithm or methodology could result in a new product_version.

summary

Summary

keywords

Keywords

keywords_vocabulary

Vocabulary of keywords. Default: GCMDSK:GCMD Science Keywords:https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/sciencekeywords, GCMDPROV:GCMD

references

Published or web-based references that describe the data or methods used to produce it. Recommend URIs (such as a URL or DOI) for papers or other references. This attribute is defined in the CF conventions.

title

Title of data set

title_no

Title of data set in Norwegian

additional_attributes

List of attributes to add to the netCDF file. The default is NULL but it could be something like list("distribution_statement"="Free", "title"="Temperature projections for Norway")

verbose

TRUE If TRUE, print information on progress.

history

Provides an audit trail for modifications to the original data. This attribute is also in the NetCDF Users Guide: 'This is a character array with a line for each invocation of a program that has modified the dataset. Well-behaved generic netCDF applications should append a line containing: date, time of day, user name, program name and command arguments.' To include a more complete description you can append a reference to an ISO Lineage entity; see NOAA EDM ISO Lineage guidance.

date_created

The date on which this version of the data was created. (Modification of values implies a new version, hence this would be assigned the date of the most recent values modification.) Metadata changes are not considered when assigning the date_created. The ISO 8601:2004 extended date format is recommended, as described in the Attribute Content Guidance section.

summary_no

Summary in Norwegian

Details

To save space, the values are saved as short (16-bit signed integer that can hold values between -32768 and 32767). (see NC_SHORT in https://www.unidata.ucar.edu/software/netcdf/docs/data_type.html).

Value

None

See Also

write2ncdf4


metno/esd documentation built on April 29, 2024, 3:34 p.m.