Skip to content

Commit f47ae80

Browse files
committed
Update {{cookiecutter.postprocessor_name}}.py
1 parent 708a3ba commit f47ae80

File tree

1 file changed

+61
-9
lines changed

1 file changed

+61
-9
lines changed

{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/{{cookiecutter.postprocessor_name}}.py

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,42 @@
66
in this module and other relevant information.
77
"""
88

9-
def {{cookiecutter.postprocessor_name }}_xxx(**kwargs):
9+
# Function {{ cookiecutter.postprocessor_name }}_xxx to create postprocess plugins named xxx.
10+
11+
# IMPORTANT: The name of the postprocessor should follow the "postprocessor_name"
12+
# naming convention. The "postprocessor_" prefix to the postprocessor name is MANDATORY since it is
13+
# used by the pysteps interface.
14+
#
15+
# Check the pysteps documentation for examples of postprocessors names that follow this
16+
# convention:
17+
# https://pysteps.readthedocs.io/en/latest/pysteps_reference/io.html#available-postprocessors
18+
#
19+
# The function prototype for the postprocessor's declaration should have the following form:
20+
#
21+
# def postprocess_xxx(filename, keyword1="some_keyword", keyword2=10, **kwargs):
22+
#
23+
#
24+
# Function arguments
25+
# ~~~~~~~~~~~~~~~~~~
26+
#
27+
# The function arguments should have the following form:
28+
# (filename, keyword1="some_keyword", keyword2=10,...,keywordN="something", **kwargs)
29+
# The `filename` and `**kwargs` arguments are mandatory to comply with the pysteps
30+
# interface. To fine-control the behavior of the postprocessor, additional keywords can be
31+
# added to the function.
32+
# For example: keyword1="some_keyword", keyword2=10, ..., keywordN="something"
33+
# It is recommended to declare the keywords explicitly in the function to improve the
34+
# readability.
35+
#
36+
#
37+
# Return arguments
38+
# ~~~~~~~~~~~~~~~~
39+
#
40+
# The postprocessor should always return the following fields:
41+
#
42+
#
43+
44+
def {{cookiecutter.postprocessor_name}}_xxx(filename, **kwargs):
1045
"""
1146
A detailed description of the postprocessor. A minimal documentation is
1247
strictly needed since the pysteps postprocessors interface expect docstrings.
@@ -17,15 +52,32 @@ def {{cookiecutter.postprocessor_name }}_xxx(**kwargs):
1752
Grib format.
1853
1954
Parameters
20-
----------
21-
parameter1: str
22-
description
23-
55+
----------
56+
filename : str
57+
Name of the file to be processed.
58+
59+
keyword1 : str
60+
Some keyword used to fine control the postprocessor behavior.
61+
62+
keyword2 : int
63+
Another keyword used to fine control the postprocessor behavior.
64+
65+
{extra_kwargs_doc}
66+
67+
####################################################################################
68+
# The {extra_kwargs_doc} above is needed to add default keywords added to this #
69+
# postprocessor by the pysteps.decorator.postprocess_postprocess decorator. #
70+
# IMPORTANT: Remove these box in the final version of this function #
71+
####################################################################################
2472
Returns
2573
-------
26-
output: array
27-
description
74+
filename: file
75+
The file having been processed.
2876
"""
77+
####################################################################################
78+
# Add the code required to run the postprocessor here.
79+
file = open(filename, "w")
80+
file.write("hello world")
81+
file.close()
82+
return file
2983

30-
output = "hello world"
31-
return output

0 commit comments

Comments
 (0)