Newer
Older
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# creation of all required metadata for the request to the analysis service."
]
},
"execution_count": null,
"outputs": [],
"from datetime import datetime\n",
"from toargridding.metadata import TimeSample, Metadata\n",
"sampling = \"daily\" # FIXME check monthly !!!\n",
"start = datetime(2010, 1, 1)\n",
"statistics_endpoint = \"https://toar-data.fz-juelich.de/api/v2/analysis/statistics/\"\n",
"statistic = \"mean\"\n",
"\n",
"time = TimeSample(start, end, sampling=sampling)\n",
"metadata = Metadata.construct(\"mole_fraction_of_ozone_in_air\", time, statistic)\n",
"\n",
"start_time = datetime.now()\n",
"print(start_time)"
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# setting up of directories for the download of the data and retrival of dataset"
]
},
"execution_count": null,
"outputs": [],
"from pathlib import Path\n",
"from toargridding.toar_rest_client import AnalysisServiceDownload\n",
"#creation of output directories\n",
"toargridding_base_path = Path(\".\")\n",
"cache_dir = toargridding_base_path / \"cache\"\n",
"download_dir = toargridding_base_path / \"results\"\n",
"cache_dir.mkdir(parents=True, exist_ok=True)\n",
"download_dir.mkdir(parents=True, exist_ok=True)\n",
"analysis_service = AnalysisServiceDownload(statistics_endpoint, cache_dir, download_dir)\n",
"results = analysis_service.get_data(metadata)\n",
"\n",
"end_time = datetime.now()\n",
"print(end_time-start_time)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "toargridding-g-KQ1Hyq-py3.10",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
}
},
"nbformat": 4,
"nbformat_minor": 2
}