2Test plugin for the ICON Community Interface (ComIn)
4This simple test plugin shows how to use the basic features of
5ComIn analogous to simple_c_plugin and simple_fortran_plugin.
7@authors 11/2023 :: ICON Community Interface <comin@icon-model.org>
9SPDX-License-Identifier: BSD-3-Clause
11Please see the file LICENSE in the root of the source tree for this code.
12Where software is supplied by third parties, it is indicated in the
13headers of the routines.
20parser = argparse.ArgumentParser()
21parser.add_argument(
"--hello", help=
"just a dummy argument")
22parser.add_argument(
"arg", help=
"just a dummy argument")
36comin.var_request_add((
"simple_python_var", 1),
False)
39comin.var_request_add((
"simple_python_tracer", -1),
False)
43@comin.EP_SECONDARY_CONSTRUCTOR
45 global pres, simple_python_var, simple_python_tracer
46 print(
"simple_python_constructor called!", file=sys.stderr)
48 [comin.EP_ATM_WRITE_OUTPUT_BEFORE], (
"pres", 1), comin.COMIN_FLAG_READ
51 [comin.EP_ATM_WRITE_OUTPUT_BEFORE],
52 (
"simple_python_var", 1),
53 comin.COMIN_FLAG_READ | comin.COMIN_FLAG_WRITE,
56 [comin.EP_ATM_WRITE_OUTPUT_BEFORE],
57 (
"simple_python_tracer", 1),
58 comin.COMIN_FLAG_READ | comin.COMIN_FLAG_WRITE,
60 print(
"tracer dim_semantics:", simple_python_tracer.dim_semantics)
61 print(
"tracer ncontained:", simple_python_tracer.ncontained)
64@comin.EP_ATM_WRITE_OUTPUT_BEFORE
66 print(
"simple_python_diagfct called!", file=sys.stderr)
67 np.asarray(simple_python_var)[:] = np.asarray(pres) + 42.0
68 np.asarray(simple_python_tracer)[:] = np.asarray(simple_python_var) / 1337.0
73 print(
"simple_python_destructor called!", file=sys.stderr)
var_get(List[entry_point] context, Tuple[str, int] var_descriptor, int flag)
get variable object, arguments: [entry point], (name string, domain id), access flag)
metadata_set(Tuple[str, int] var_descriptor, **kwargs)
sets metadata for a requested field, arguments: name string, domain id, metadata key,...
plugin_info current_get_plugin_info()
returns object describing the current plugin
simple_python_constructor()
simple_python_destructor()