{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Metobs without observational data\n", "\n", "For some applications you do not have observational data (yet), but you still want to use the Metobs toolkit functionality on the metadata (the locations of the stations). In the toolkit, this is implemented as *\"metadata-only\"* ``Datasets``. \n", "\n", "These ``Dataset``s do not hold observational data, and thus no outliers and gaps, but only metadata. The process for creating a *\"metadata-only\"* ``Datasets`` is similar to creating a regular ``Dataset``." ] }, { "cell_type": "code", "execution_count": 1, "id": "9e5e1a73", "metadata": {}, "outputs": [], "source": [ "import metobs_toolkit" ] }, { "cell_type": "code", "execution_count": 2, "id": "1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%script true\n", "\n", "# start by making a template, and answer \"N\" when asked if you have an observational data file\n", "metobs_toolkit.build_template_prompt()" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "As an example, we use the demo metadata file and use it to create a \"metadata-only\" ``Dataset`` by applying the ``Dataset.import_only_metadata_from_file()`` method." ] }, { "cell_type": "code", "execution_count": 3, "id": "3", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "The following columns are found in the metadata, but not in the template and are therefore ignored: \n", "['Network', 'benaming', 'sponsor', 'stad']\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "================================================================================\n", " General info of Dataset \n", "================================================================================\n", "\n", "\n", "--- Observational info ---\n", "\n", " -Dataset instance without observation records.\n", "\n", "--- Metadata info ---\n", "\n", " -28 number of stations\n", " -The following metadata is present: ['lat', 'lon', 'school', 'geometry']\n", "\n", "--- Modeldata info ---\n", "\n", " -Dataset instance without modeldata.\n", "\n" ] } ], "source": [ "# Initiate an empty dataset\n", "dataset = metobs_toolkit.Dataset()\n", "# Update the paths to the metadata and template file\n", "#Load the data\n", "dataset.import_data_from_file(\n", " template_file=metobs_toolkit.demo_template, #The template file\n", " input_data_file=None, #Do not provide an observational data file\n", " input_metadata_file=metobs_toolkit.demo_metadatafile, #The metadata file\n", " )\n", "\n", "dataset.get_info()" ] }, { "cell_type": "markdown", "id": "2e558b5a", "metadata": {}, "source": [ "We have a dataset without observational data (no ``SensorData`` in the ``Station``s). We can not apply methods related to observational data, but methods related to metadata can be applied similar as if there where observations.\n", "\n", "In practice this can be used to extract timeseries (i.g. ERA5) or static data (i.g. LCZ, altitude, landcover fractions) from GEE. See the [GEE Example Notebook](../examples/gee_example.ipynb) for a full demonstration." ] } ], "metadata": { "kernelspec": { "display_name": "metobs_dev", "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.12.10" } }, "nbformat": 4, "nbformat_minor": 5 }