Skip to content

Commit

Permalink
chore(examples): Automatic commit of example files in Markdown and Ju…
Browse files Browse the repository at this point in the history
…pyter Notebook format.
  • Loading branch information
[email protected] authored and [email protected] committed Dec 13, 2024
1 parent 577238b commit 00ecd65
Showing 1 changed file with 130 additions and 130 deletions.
260 changes: 130 additions & 130 deletions docs/jupyter_notebooks/e1_pull_DWD_historical_to_all_output_formats.ipynb
Original file line number Diff line number Diff line change
@@ -1,131 +1,131 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": "# AixWeather Tutorial\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "This example is a step-by-step guide to pull historical weather data from the DWD open access database\nand convert it to different output formats.\nThus showing all possible steps on how to use AixWeather.\nTo run the tool for other weather data sources, just change the project class.\nThe rest of the code is streamlined and will remain the same.\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Enable logging, this is just to get more feedback through the terminal\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "import logging\nlogging.basicConfig(level=\"DEBUG\")\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Choose the project class according to the desired weather data origin.\nCheck the project classes file or the API documentation to see which classes are available.\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "from aixweather.project_class import ProjectClassDWDHistorical\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 0: Initiate the project class which contains or creates all variables and functions.\nFor this, we use the datetime module to specify dates.\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "import datetime as dt\nDWD_pull_project = ProjectClassDWDHistorical(\n start=dt.datetime(2022, 1, 1),\n end=dt.datetime(2023, 1, 1),\n station=15000,\n # specify whether nan-values should be filled when exporting\n fillna=True,\n # define results path if desired\n abs_result_folder_path=None,\n)\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 1: Import historical weather from the DWD open access database\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "DWD_pull_project.import_data()\nprint(\n f\"\\nHow the imported data looks like:\\n{DWD_pull_project.imported_data.head()}\\n\"\n)\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 2: Convert this imported data to the core format\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "DWD_pull_project.data_2_core_data()\nprint(f\"\\nHow the core data looks like:\\n{DWD_pull_project.core_data.head()}\\n\")\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "You may optionally also use data quality check utils, like:\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "from aixweather.data_quality_checks import plot_heatmap_missing_values\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Plot data quality\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "plot = plot_heatmap_missing_values(DWD_pull_project.core_data)\nplot.show()\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 3: Convert this core data to an output data format of your choice\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "DWD_pull_project.core_2_csv()\nDWD_pull_project.core_2_json()\nDWD_pull_project.core_2_pickle()\nDWD_pull_project.core_2_mos()\nDWD_pull_project.core_2_epw()\n"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": "# AixWeather Tutorial\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "This example is a step-by-step guide to pull historical weather data from the DWD open access database\nand convert it to different output formats.\nThus showing all possible steps on how to use AixWeather.\nTo run the tool for other weather data sources, just change the project class.\nThe rest of the code is streamlined and will remain the same.\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Enable logging, this is just to get more feedback through the terminal\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "import logging\nlogging.basicConfig(level=\"DEBUG\")\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Choose the project class according to the desired weather data origin.\nCheck the project classes file or the API documentation to see which classes are available.\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "from aixweather.project_class import ProjectClassDWDHistorical\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 0: Initiate the project class which contains or creates all variables and functions.\nFor this, we use the datetime module to specify dates.\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "import datetime as dt\nDWD_pull_project = ProjectClassDWDHistorical(\n start=dt.datetime(2022, 1, 1),\n end=dt.datetime(2023, 1, 1),\n station=15000,\n # specify whether nan-values should be filled when exporting\n fillna=True,\n # define results path if desired\n abs_result_folder_path=None,\n)\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 1: Import historical weather from the DWD open access database\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "DWD_pull_project.import_data()\nprint(\n f\"\\nHow the imported data looks like:\\n{DWD_pull_project.imported_data.head()}\\n\"\n)\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 2: Convert this imported data to the core format\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "DWD_pull_project.data_2_core_data()\nprint(f\"\\nHow the core data looks like:\\n{DWD_pull_project.core_data.head()}\\n\")\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "You may optionally also use data quality check utils, like:\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "from aixweather.data_quality_checks import plot_heatmap_missing_values\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Plot data quality\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "plot = plot_heatmap_missing_values(DWD_pull_project.core_data)\nplot.show()\n"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Step 3: Convert this core data to an output data format of your choice\n"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "DWD_pull_project.core_2_csv()\nDWD_pull_project.core_2_json()\nDWD_pull_project.core_2_pickle()\nDWD_pull_project.core_2_mos()\nDWD_pull_project.core_2_epw()\n"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 00ecd65

Please sign in to comment.