README.md 1.74 KB
Newer Older
bearecinos's avatar
bearecinos committed
1
# Model Data Format reader: `mdf_reader` toolbox
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
2

bearecinos's avatar
bearecinos committed
3 4 5 6 7 8 9 10
The `mdf_reader` is a [python3](https://www.python.org/) tool designed to read data files compliant with a user specified [data
model](https://cds.climate.copernicus.eu/toolbox/doc/how-to/15_how_to_understand_the_common_data_model/15_how_to_understand_the_common_data_model.html). It was developed to read the [IMMA](https://icoads.noaa.gov/e-doc/imma/R3.0-imma1.pdf) (International Maritime Meteorological Archive) data format, but it has been enhanced to account for meteorological data formats in the case of:

- Data that is stored in a human-readable manner: “ASCII” format.
- Data that is organized in single line reports
- Reports that have a coherent internal structure and can be modelised.
- Reports that have a fixed width or field delimited types
- Reports that can be organized in sections, in which case each section can be of different types (fixed width of delimited)
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
11

bearecinos's avatar
bearecinos committed
12
1. Clone the repository
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
13

bearecinos's avatar
bearecinos committed
14 15 16
```
git clone git@git.noc.ac.uk:brecinosrivas/mdf_reader.git
```
bearecinos's avatar
bearecinos committed
17 18
2. Install requirements (see [requirements.txt](https://git.noc.ac.uk/brecinosrivas/mdf_reader/-/blob/master/requirements.txt)).
   > More information about python environments [here](https://git.noc.ac.uk/brecinosrivas/guide-to-jupyter-notebooks).
bearecinos's avatar
bearecinos committed
19

bearecinos's avatar
bearecinos committed
20
3. Run a test:
bearecinos's avatar
bearecinos committed
21 22
```
import sys
bearecinos's avatar
bearecinos committed
23
sys.path.append('/path_to_folder_directory_containing_the_mdf_reader_folder/')
bearecinos's avatar
bearecinos committed
24
import mdf_reader
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
25 26
import matplotlib.pyplot as plt

Irene Perez Gonzalez's avatar
Updated  
Irene Perez Gonzalez committed
27
data = mdf_reader.tests.read_imma1_buoys_nosupp()
bearecinos's avatar
bearecinos committed
28
```
bearecinos's avatar
bearecinos committed
29
4. Read imma data
bearecinos's avatar
bearecinos committed
30
```
Irene Perez Gonzalez's avatar
Updated  
Irene Perez Gonzalez committed
31
imma_data = mdf_reader.read(filepath, data_model = 'imma1',sections = ['core','c1','c98'])
bearecinos's avatar
bearecinos committed
32
```
Irene Perez Gonzalez's avatar
Updated  
Irene Perez Gonzalez committed
33

bearecinos's avatar
bearecinos committed
34
For more details on how to use the `mdf_reader` tool see the following [jupyter notebooks](https://git.noc.ac.uk/brecinosrivas/mdf_reader/-/tree/master/docs/notebooks).