Skip to content

Commit 4f8eb24

Browse files
committed
2 parents f202041 + 9b179d9 commit 4f8eb24

File tree

2 files changed

+111
-1
lines changed

2 files changed

+111
-1
lines changed

CITATION.cff

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# This CITATION.cff file was generated with cffinit.
2+
# Visit https://bit.ly/cffinit to generate yours today!
3+
4+
cff-version: 1.2.0
5+
title: >-
6+
PyCrop2ML : Python library to exchange and reuse crop
7+
model compponents between languages and platforms
8+
message: >-
9+
If you use this software, please cite it using the
10+
metadata from this file.
11+
type: software
12+
authors:
13+
- given-names: Cyrille Ahmed
14+
family-names: Midingoyi
15+
affiliation: CIRAD
16+
17+
- given-names: Christophe
18+
family-names: Pradal
19+
20+
affiliation: CIRAD
21+
orcid: 'https://orcid.org/0000-0002-2555-761X'
22+
- given-names: 'Andreas '
23+
family-names: Enders
24+
affiliation: >-
25+
Institute of Crop Science and Resource Conservation
26+
(INRES), University of Bonn, Bonn, Germany,
27+
- given-names: Davide
28+
family-names: Fumagalli
29+
- given-names: Patrice
30+
family-names: Lecharpentier
31+
affiliation: INRAE
32+
- given-names: 'Hélène '
33+
family-names: Raynal
34+
affiliation: INRAE
35+
- given-names: 'Marcello '
36+
family-names: Donatelli
37+
affiliation: CREAA
38+
- given-names: Ioannis N.
39+
family-names: Athanasiadis
40+
affiliation: 'Wageningen University, Wageningen, The Netherlands'
41+
- given-names: 'Cheryl '
42+
family-names: Porter
43+
affiliation: >-
44+
Agricultural & Biological Engineering, University of
45+
Florida, Gainesville, USA
46+
- given-names: 'Gerrit '
47+
family-names: Hoogenboom
48+
affiliation: >-
49+
Agricultural & Biological Engineering, University of
50+
Florida, Gainesville, USA
51+
- given-names: 'Dean '
52+
family-names: Holzworth
53+
affiliation: 'CSIRO Agriculture and Food, Toowoomba, Australia'
54+
- given-names: Pierre
55+
family-names: Martre
56+
affiliation: INRAE
57+
58+
repository-code: >-
59+
https://github.com/AgriculturalModelExchangeInitiative/PyCrop2ML
60+
url: 'https://crop2ml.org'
61+
abstract: >-
62+
The increasing impact of climate change and variability on
63+
food security and agriculture, and the need for
64+
agroecological transition require improving the
65+
performance of crop simulation models and to model new
66+
biophysical processes to tackle new challenges. Recently,
67+
the Agricultural Models Exchange Initiative (AMEI)
68+
proposed Crop2ML, an open-source modeling framework for
69+
exchanging and reusing crop model components between
70+
modeling platforms. This framework provides a unified
71+
description of model components at a high level of
72+
abstraction based on shared concepts, lifting constraints
73+
of modeling platforms through an automatic system that
74+
transforms high-level models into platform-compliant
75+
components. This paper presents an approach based on
76+
reverse engineering to automatically extract and transform
77+
meta-information and algorithms of existing crop model
78+
processes into a platform-independent model component. A
79+
search algorithm using Crop2ML concepts, and a many-to-one
80+
transformation system was adopted as the main reverse
81+
engineering techniques to produce high-level models. The
82+
system consists in parsing the codebase of model
83+
components from different high-level languages (Python, R,
84+
Java, C++, C#, and Fortran) using the ANother Tool for
85+
Language Recognition (ANTLR) parser generator and
86+
processing the generated syntax trees to produce the
87+
various model implementations. It is implemented and
88+
evaluated on three crop model components: an energy
89+
balance model provided by BioMA platform and two soil
90+
temperature models provided by SIMPLACE and DSSAT
91+
platforms. We demonstrated the extensibility of our
92+
approach with the STICS, OpenAlea, and SiriusQuality
93+
modeling platforms. CyMLTx is a significant contribution
94+
towards the interoperability of crop modeling platforms
95+
and the reuse of crop model components beyond programming
96+
languages. It will thus contribute to foster model
97+
intercomparison and improvement activities.
98+
keywords:
99+
- Crop2ML
100+
- AMEI
101+
- Crop Model
102+
- DSSAT
103+
- SimPlace
104+
- STICS
105+
- APSIM
106+
- OpenAlea
107+
- BioMA
108+
- RECORD
109+
license: CECILL-C

src/pycropml/transpiler/generators/simplaceGenerator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def __init__(self, tree, model=None, name=None):
1515
self.name = name
1616
JavaGenerator.__init__(self, tree, model, self.name)
1717
self.parameters_ = deepcopy(self.model.parameters)
18+
self.par_ = [p.name for p in self.parameters_ ]
1819
self.inputs_ = [inp for inp in self.model.inputs if ("variablecategory" in dir(inp) and inp.variablecategory=="auxiliary" )]
1920
self.outputs_ = [out for out in self.model.outputs if ("variablecategory" in dir(out) and out.variablecategory=="auxiliary" )]
2021
self.inputs = [inp.name for inp in self.model.inputs]
@@ -290,7 +291,7 @@ def visit_function_definition(self, node):
290291
self.write(arg.name)
291292
if arg.type=="list": self.write(" = Arrays.asList(%s.getValue());" % arg.name)
292293
else:
293-
if arg.type == "array" and "elts" in dir(arg) and len(arg.elts)>0 :
294+
if arg.type == "array" and "elts" in dir(arg) and len(arg.elts)>0 and arg.name not in self.par_ :
294295
self.write(" = new ")
295296
self.visit_decl(arg.pseudo_type[1])
296297
self.write("[")

0 commit comments

Comments
 (0)