README.md 1.28 KB
Newer Older
bearecinos's avatar
bearecinos committed
1
# Mdf_reader
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 12


bearecinos's avatar
bearecinos committed
13 14 15 16 17
1. Run a test:
```
import sys
sys.path.append('/path_to_dir_containing_the_mdf_reader_folder/')
import mdf_reader
Irene Perez Gonzalez's avatar
Irene Perez Gonzalez committed
18 19
import matplotlib.pyplot as plt

Irene Perez Gonzalez's avatar
Updated  
Irene Perez Gonzalez committed
20
data = mdf_reader.tests.read_imma1_buoys_nosupp()
bearecinos's avatar
bearecinos committed
21
```
Irene Perez Gonzalez's avatar
Updated  
Irene Perez Gonzalez committed
22
2. Read imma data
bearecinos's avatar
bearecinos committed
23
```
Irene Perez Gonzalez's avatar
Updated  
Irene Perez Gonzalez committed
24
imma_data = mdf_reader.read(filepath, data_model = 'imma1',sections = ['core','c1','c98'])
bearecinos's avatar
bearecinos committed
25
```
Irene Perez Gonzalez's avatar
Updated  
Irene Perez Gonzalez committed
26

bearecinos's avatar
bearecinos committed
27
For more details on how to use the `mdf_reader` tool see the following jupyter notebooks.