{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How to read meteorological data with `read_mdf` function" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from __future__ import annotations\n", "\n", "import pandas as pd\n", "\n", "from cdm_reader_mapper import properties, read_mdf, test_data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `cdm_reader_mapper.read_mdf` function and is a tool designed to read data files compliant with a user specified [data\n", "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).\n", "\n", "It was developed with the initial idea to read the [IMMA](https://icoads.noaa.gov/e-doc/imma/R3.0-imma1.pdf) data format, but it was further enhanced to account for other meteorological data formats.\n", "\n", "Lets see an example for a typical file from [ICOADSv3.0.](https://icoads.noaa.gov/r3.html). We pick an specific monthly output for a Source/Deck. In this case data from the Marine Meterological Journals data set SID/DCK: **125-704 for Oct 1878.**\n", "\n", "The `.imma` file looks like this:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | 18781020 600 4228 29159 130623 10Panay 12325123 9961 4 165 17128704125 5 0 1 1FF111F11AAA1AAAA1AAA 9815020N163002199 0 100200180003Panay 78011118737S.P.Bray,Jr 013231190214 Bulkhead of cabin 1- .1022200200180014Boston Rio de Janeiro 300200180014001518781020 4220N 6630W 10 E 400200180014001518781020102 85 EXS WSW 0629601 58 BOC CU05R | \n", "
|---|---|
| 0 | \n", "18781020 800 4231 29197 130623 10Panay 1... | \n", "
| 1 | \n", "187810201000 4233 29236 130623 10Panay 1... | \n", "
| 2 | \n", "187810201200 4235 29271 130623 10Panay 1... | \n", "
| 3 | \n", "187810201400 4237 29310 130623 10Panay 1... | \n", "
| \n", " | sentinel | \n", "reel_no | \n", "journal_no | \n", "frame_no | \n", "ship_name | \n", "journal_ed | \n", "rig | \n", "ship_material | \n", "vessel_type | \n", "vessel_length | \n", "... | \n", "hold_depth | \n", "tonnage | \n", "baro_type | \n", "baro_height | \n", "baro_cdate | \n", "baro_loc | \n", "baro_units | \n", "baro_cor | \n", "thermo_mount | \n", "SST_I | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "1 | \n", "002 | \n", "0018 | \n", "0003 | \n", "Panay | \n", "78 | \n", "01 | \n", "1 | \n", "1 | \n", "187 | \n", "... | \n", "23 | \n", "1190 | \n", "2 | \n", "14 | \n", "None | \n", "Bulkhead of cabin | \n", "1 | \n", "- .102 | \n", "2 | \n", "None | \n", "
| 1 | \n", "1 | \n", "002 | \n", "0018 | \n", "0003 | \n", "Panay | \n", "78 | \n", "01 | \n", "1 | \n", "1 | \n", "187 | \n", "... | \n", "23 | \n", "1190 | \n", "2 | \n", "14 | \n", "None | \n", "Bulkhead of cabin | \n", "1 | \n", "- .102 | \n", "2 | \n", "None | \n", "
| 2 | \n", "1 | \n", "002 | \n", "0018 | \n", "0003 | \n", "Panay | \n", "78 | \n", "01 | \n", "1 | \n", "1 | \n", "187 | \n", "... | \n", "23 | \n", "1190 | \n", "2 | \n", "14 | \n", "None | \n", "Bulkhead of cabin | \n", "1 | \n", "- .102 | \n", "2 | \n", "None | \n", "
| 3 | \n", "1 | \n", "002 | \n", "0018 | \n", "0003 | \n", "Panay | \n", "78 | \n", "01 | \n", "1 | \n", "1 | \n", "187 | \n", "... | \n", "23 | \n", "1190 | \n", "2 | \n", "14 | \n", "None | \n", "Bulkhead of cabin | \n", "1 | \n", "- .102 | \n", "2 | \n", "None | \n", "
| 4 | \n", "1 | \n", "002 | \n", "0018 | \n", "0003 | \n", "Panay | \n", "78 | \n", "01 | \n", "1 | \n", "1 | \n", "187 | \n", "... | \n", "23 | \n", "1190 | \n", "2 | \n", "14 | \n", "None | \n", "Bulkhead of cabin | \n", "1 | \n", "- .102 | \n", "2 | \n", "None | \n", "
5 rows × 24 columns
\n", "