Template plugin for fluxes (flux
/ template
)¶
Description¶
This is a template to write a flux plugin. It includes all required functions to run properly.
It generates random values and can be directly used with a working test case.
Warning
Please gradually document your plugin properly when starting from the template.
It includes input_arguments
(see here for details),
as well as all information about the original data the plugin is supposed to
accommodate.
Please include licensing information, permanent link to download the data (or a contact person if no link is publicly available), as well as data format (temporal and horizontal resolution, names and shape of the data files), and any specific treatment that prevents the plugin from working with another type of files.
Summary steps to integrate a new flux data plugin¶
First steps to integrate your own flux plugin from the template¶
To integrate your own flux plugin, please follow the steps:
copy the
flux_plugin_template
directory into one with a name of your preferenceStart writing the documentation of your plugin by replacing the present
docstring
in the file__init__.py
. Use rst syntax since this doctring will be automatically parsed for publication in the documentationChange the variables
_name
,_version
(default isstd
) if not specified, and_fullname
(optional, is used as a title when automatically generating the documentation here)
Now your new plugin is ready to be used in your test case with random data.
Further integration of your own plugin¶
Now that your plugin can be used in a yml and generate random values, you need to integrate the main functions feeding the plugin.
fetch
: fetch data files
read
: read data files
write
: write data files
Please find further details here.
Yaml arguments¶
The following arguments are used to configure the plugin. pyCIF will return an exception at the initialization if mandatory arguments are not specified, or if any argument does not fit accepted values or type:
Optional arguments¶
dir: (optional):
Path to the corresponding component. This value is used if not provided in parameters
accepted type: str
file: (optional):
File format in the given directory. This value is used if not provided in parameters
accepted type: str
varname: (optional):
Variable name to use to read data filesinstead of the parameter name if different to the parameter name
accepted type: str
file_freq: (optional): 1D
The time frequency at which data files are available.
accepted type: str
dummy_arg: (optional): let’s say it’s not mandatory
document here the argument
accepted type: str
lon_min: (optional): -180
Minimum longitude
accepted type: float
lon_max: (optional): 180
Maximum longitude
accepted type: float
lat_min: (optional): -90
Minimum latitude
accepted type: float
lat_max: (optional): 90
Maximum latgitude
accepted type: float
nlon: (optional): 90
Number of grid cells in the zonal direction
accepted type: int
nlat: (optional): 45
Number of grid cells in the meridional direction
accepted type: int
nlev: (optional): 1
Number of levels in the data
accepted type: int
average_value: (optional): 1
Average value for the generation of random values
accepted type: float
Yaml template¶
Please find below a template for a Yaml configuration:
1datastream:
2 plugin:
3 name: flux
4 version: template
5 type: datastream
6
7 # Optional arguments
8 dir: XXXXX # str
9 file: XXXXX # str
10 varname: XXXXX # str
11 file_freq: XXXXX # str
12 dummy_arg: XXXXX # str
13 lon_min: XXXXX # float
14 lon_max: XXXXX # float
15 lat_min: XXXXX # float
16 lat_max: XXXXX # float
17 nlon: XXXXX # int
18 nlat: XXXXX # int
19 nlev: XXXXX # int
20 average_value: XXXXX # float