Flowchart (METRo)
From Documentation
This article shows the flowchart of METRo. You might also want to look at the schema of I/O as a complement to the comprehension of METRo source code.
This article aims the METRo developers. You do not need to understand it if you only want to install and to use METRo.
Contents |
[edit] Flowchart
- Green: code in python;
- Cyan: code in fortran;
- Red: code in C;
- Orange: data in XML format;
You can view the image in full resolution.
[edit] Modules
The fortran code contains the physic model of METRo. The code is located in the directory model.
All the python code is locate in the directory under the one named frontend. All the modules of METRo, except for the physic model, is coded in this language.
[edit] Configuration
The configuration module is the file named metro_config.py and contains all the methods that METRo needs to access the configuration all along his execution. It is why it can be called by any modules of METRo.
This files also contains the order of which the METRo modules are invoked. See the dictionnary value of INIT_MODULE_EXECUTION_SEQUENCE in this file to see the default order. One as only to write a module and add is name when it would be runs.
[edit] Input reading
[edit] Pre-processing
[edit] Model
The physical model of METRo is coded in fortran. It corresponds to the central part of the flowchart, the part that contains red and cyan block. The model is called by the python module named metro_model.py, by the method called macadam.Do_Metro(...).
The physics and other constants used in METRo are in the file metro_constant.py and constPhys.f.
[edit] C wrapper
Macadam is the name of the project that contains the wrapper for the fortran code. The C file is unique and is named macadam.c. The fortran methods are called from this file in a determine order. There is some logic in this file but only to determine which fortran function to invoke, not to perform computation.
For each list or array that one wants to retrieve from the C code, a function must be implemented in the file macadam.h and written in the file macadam.i (see below). The function is a simple return of the structure containing the data. See the code for example.
The type of data that can be returned by the fortran up to the python code are in the file macadam.i. Unless you really, really know what you are doing, do not touch the functions already present in this file, as they are the SWIG wrapper of METRo. Arrays are also supported and are simply called by using the word Struct after the type of data (double array would be doubleStruct).
The following data are supported:
- char;
- double;
- float;
- long;
- short;
- int;
[edit] Post-processing
[edit] Output writing
[edit] Coding convention
The following code convention have been followed in the python code of METRo and some of it in the C and fortran code. As much as possible, all the code of METRo should respect it.
- All the python modules of METRo starts with the string metro_;
- Pre-process modules starts with the string metro_preprocess_"
- Post-process modules starts with the string metro_postprocess_"
- The Hungarian notation is used in METRo. This is the corresponding signification:
| Letter(s) | Variable type |
|---|---|
| n | integer |
| f | float |
| d | double |
| t | tuple |
| p | pointer |
| l | list |
| wf | weather forecast (object) |
| c | class |
| st | structure |
| na | numarray (deprecated) |
| np | numpy |
| METRo I/O files |
| Station | Observation | Forecast | Roadcast | Configuration |
| METRo I/O specification |
| Schema | | Flowchart | Format | Date | Observation QA/QC | Road condition | Station type | Time zone | Layer type | Latitude and longitude |
| METRo I/O examples |
| Station | Observation | Forecast | Roadcast | Graphical display |
| This page is part of the documentation of the METRo software. Back to the table of content. |

