pik-copan / pycopancore Goto Github PK
View Code? Open in Web Editor NEWreference implementation of the copan:CORE World-Earth modelling framework
Home Page: http://www.pik-potsdam.de/copan
License: Other
reference implementation of the copan:CORE World-Earth modelling framework
Home Page: http://www.pik-potsdam.de/copan
License: Other
Enhance the templates and their documentation to make it easier for newbies to work with the framework. Maybe this is to be done when developing a new component, so nothing is forgotten to be included
From PIK's open source recommendations: "use http://contributoragreements.org to create a contributor agreement". They recommend the following settings:
Goal: Allow for...
class Cell (object):
fossil_reserve = Variable(name="cellular fossil reserve", desc="...", dimension=Carbon)
import pycopancore.components.fossil_extraction.interface as FE
class Cell (object):
fossil_reserve = FE.Cell.fossil_reserve
class Cell (object):
fossil_reserve = Variable(name="cellular fossil reserve", desc="...", dimension=Carbon)
import pycopancore.master_data_model as MDM
class Cell (object):
fossil_reserve = MDM.Cell.fossil_reserve
To maintain harmonized variable definitions and avoid coincidental name clashes, the method Model.configure() must make sure that if two of the components used in the model at hand define the same variable name, it must point to the same Variable object (as in the examples above). It may even make sure that if a component uses a variable name that exists in the MDM, it must point to the Variable object defined in the MDM.
Still, components should probably be allowed to use another component's (or the master data model's) variables under a locally different name, as in:
import pycopancore.components.fossil_extraction.interface as FE
class Cell (object):
geological_carbon_stock = FE.Cell.fossil_reserve
In perspective ...
Need to implement interpolation for step and event values in runner.
Check PIK best practice documents on open source licenses.
#25 depends on the implementation of a MasterDataModel, where variables which are used by several components are defined
Implement feature to change the number of entities by creation or annihilation (maybe also merge/split?). Where is the right place in the code for this?
@KilianZimmerer @mensch72
Either
or
As @mensch72 mentioned in #27, a model fact sheet following the guidelines here should be created.
PS: As it's unrelated to #27, I made a new issue for this.
Jede Entity hat ein Attribut, zu welcher World es gehört. Da das ja bei jeder Entity ausser bei World selber nötig ist, ist das nun im Branch https://github.com/pik-copan/pycopancore/tree/world_entity_type (world_entity_type) in der Abstract_Entity_Mixin Klasse implementiert. Jetzt gibt es nur den Schönheitsfehler, dass man beim Initialisieren von world selber auch etwas angeben muss um dieses Attribut zu füllen, derzeit ist das mit None gemacht. Das ist aber nicht schön. Wie kann man das schöner machen?
Think about content, journal, length etc.
Since now we are programming a lot in single classes without using them, it might be the right time to write some unit-test? If so, do we put them into the tests folder and name them something like filename_test.py? Or folder_filename_test.py? Is there an established naming scheme?
Change Formatting of strings from old to new style to make code more consistent:
https://pyformat.info/
@KilianZimmerer
This is a question that came to my mind lately. When initializing the model, where do we have creation routines of cells etc.? At low levels, so for example at the planet or donut_world class that creates a grid or - in case of individuals - a network that includes individuals? Or at model level?
I prefer creating instances at lower level to make the model class more manageable, but I see probels with this idea too: So in my example, the donut_world class is made to work with the local_renewable_resource class. With another class it may not work...
I am not shure how connected these problems are, because I don't have a clear picture of the model structure in detail in my mind, yet. Maybe we can discuss this soon, I think otherwise we will have inconsequent structure later
I implemented a second ODE in dummy/cell.py. It turned out that the model can't handle that yet. I pushed the model setup with two ODEs to the branch "2ode_bug, so that you can check it out @tillkolster.
If there are any suggestion to improve or enhance the existing code leave them here.
Edit by Till:
This is just a thread to collect pieces of code to show how there is a more elegant way and to keep them as a sort of style guide by examples
The test-environment is set up, now we need to write some test, maybe also a test template
Implement the option to raise events caused by a process during a integration. Until now the time an event takes place is decided before, a sudden event is not possible. Runner-logic must be changed to allow for this.
How does time integration work in the model? What integrator to use? (Frank has an alpha version of a solver of algebro-differential equations)
Basic problem / challenge of combining continuous and irregularly discrete dynamics.
PEP257 is giving out a lot of errors, since it requires a very strict formatting of docstrings. Do we want this? One of the complaints is this:
<<First word of the docstring should not be This
[pep257]>>
This might be very annoying during further coding...
After the meeting, I was discussing with Wolf and he asked me to Draft a first Code of Good Practice for coding, that we could put in the README. The idea is to have some guidelines/recommendations/hints that we want to follow so the code is legible, easy to debug and easy to expand.
PS: I can't assign myself, could somebody with the correct rights do that?
What is a recommended way to handle networks in CORE components: use a performant, but simple library for this: igraph, graphtool, boostgraph ? Check what is recommended and define criteria for selection.
While going through the code Svenja noticed some confusing use of naming. This led us to start a general discussion about it.
Each underlying class (Cell, Society, Individual, Nature, Culture, Metabolism) has an attribute called entities, which is a list containing the classes' instances. Since only objects of the classes Society, Individual and Cell should be called entities we have to find another name for this list.
Any suggestions?
Regarding the McCabe complexity checks, we have to reduce complexity as much as possible and find new complexity thresholds.
Check for sphinx plugins.
Maybe include mandatory naming of variables when calling functions. Assure that this is the case for all functions by using the testing environment
Write a plotting component which works with the trajectory dictionary which is returned by the runner.
How to represent network between different model entities ?
As in the exploit model, some models might terminate on their own (before the end time t_1
) where the runner should stop execution.
How do we pass this to the runner?
Any suggestions @mensch72 ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.