{ "cells": [ { "cell_type": "markdown", "id": "609d168f", "metadata": {}, "source": [ "### How does the imported datasets look like?\n", "Here we show how the impoted predictors and predictand datasets look like. We show for one example of the weather station (stuttgart) and predictor (tp: total precipitation)\n", "1. read the csv file loaded as Weather station object using pandas \n", "2. demonstrate the structure of the ERA5 datasets used predictor sets for this exercise\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "905ff8d1", "metadata": {}, "outputs": [], "source": [ "# set paths to the datasets\n", "stationdir = \"C:/Users/dboateng/Desktop/Python_scripts/ESD_Package/examples/tutorials/data\"\n", "predictordir = \"C:/Users/dboateng/Desktop/Datasets/ERA5/monthly_1950_2021/\"\n", "name_station= \"stuttgart.csv\"\n", "filename_predictor = \"tp_monthly.nc\"" ] }, { "cell_type": "code", "execution_count": 2, "id": "35b36698", "metadata": {}, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import xarray as xr" ] }, { "cell_type": "code", "execution_count": 4, "id": "fe15f36c", "metadata": {}, "outputs": [], "source": [ "# read the station data\n", "df = pd.read_csv(os.path.join(stationdir, name_station))" ] }, { "cell_type": "code", "execution_count": 5, "id": "82bf874b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Station | \n", "Stuttgart (Schnarrenberg) | \n", "
---|---|---|
0 | \n", "Latitude | \n", "48.8281 | \n", "
1 | \n", "Longitude | \n", "9.2 | \n", "
2 | \n", "Elevation | \n", "314.0 | \n", "
3 | \n", "NaN | \n", "NaN | \n", "
4 | \n", "Time | \n", "Precipitation | \n", "
5 | \n", "1958-01-01 | \n", "51.6 | \n", "
6 | \n", "1958-02-01 | \n", "107.3 | \n", "
7 | \n", "1958-03-01 | \n", "21.5 | \n", "
8 | \n", "1958-04-01 | \n", "54.2 | \n", "
9 | \n", "1958-05-01 | \n", "72.1 | \n", "
<xarray.Dataset>\n", "Dimensions: (time: 860, longitude: 1440, latitude: 721)\n", "Coordinates:\n", " expver float64 1.0\n", " * time (time) datetime64[ns] 1950-01-01 1950-02-01 ... 2021-08-01\n", " * longitude (longitude) float32 0.0 0.25 0.5 0.75 ... 359.0 359.2 359.5 359.8\n", " * latitude (latitude) float32 90.0 89.75 89.5 89.25 ... -89.5 -89.75 -90.0\n", "Data variables:\n", " tp (time, latitude, longitude) float32 ...\n", "Attributes:\n", " CDI: Climate Data Interface version 1.9.5 (http://mpimet.mpg.de/...\n", " Conventions: CF-1.6\n", " history: Sat Oct 02 22:01:38 2021: cdo -s -f nc -selname,tp ERA5_195...\n", " CDO: Climate Data Operators version 1.9.5 (http://mpimet.mpg.de/...