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 : str, optional, default “”
Path to the corresponding component. This value is used if not provided in parameters
- file : str, optional, default “”
File format in the given directory. This value is used if not provided in parameters
- varname : str, optional, default “”
Variable name to use to read data filesinstead of the parameter name if different to the parameter name
- file_freq : str, optional, default “1D”
The time frequency at which data files are available.
- split_freq : str, optional
Force splitting the processing at a given frequency different to file_freq
- dummy_arg : str, optional, default “let’s say it’s not mandatory”
document here the argument
- lon_min : float, optional, default -180
Minimum longitude
- lon_max : float, optional, default 180
Maximum longitude
- lat_min : float, optional, default -90
Minimum latitude
- lat_max : float, optional, default 90
Maximum latgitude
- nlon : int, optional, default 90
Number of grid cells in the zonal direction
- nlat : int, optional, default 45
Number of grid cells in the meridional direction
- nlev : int, optional, default 1
Number of levels in the data
- average_value : float, optional, default 1
Average value for the generation of random values
- std_value : float, optional, default 1
Standard deviation value for the generation of random values
YAML template#
Please find below a template for a YAML configuration:
1flux:
2 plugin:
3 name: flux
4 version: template
5 type: flux
6
7 # Optional arguments
8 dir: XXXXX # str
9 file: XXXXX # str
10 varname: XXXXX # str
11 file_freq: XXXXX # str
12 split_freq: XXXXX # str
13 dummy_arg: XXXXX # str
14 lon_min: XXXXX # float
15 lon_max: XXXXX # float
16 lat_min: XXXXX # float
17 lat_max: XXXXX # float
18 nlon: XXXXX # int
19 nlat: XXXXX # int
20 nlev: XXXXX # int
21 average_value: XXXXX # float
22 std_value: XXXXX # float