#!/usr/bin/env python # coding: utf-8 # ### How does the imported datasets look like? # 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) # 1. read the csv file loaded as Weather station object using pandas # 2. demonstrate the structure of the ERA5 datasets used predictor sets for this exercise # # In[3]: # set paths to the datasets stationdir = "C:/Users/dboateng/Desktop/Python_scripts/ESD_Package/examples/tutorials/data" predictordir = "C:/Users/dboateng/Desktop/Datasets/ERA5/monthly_1950_2021/" name_station= "stuttgart.csv" filename_predictor = "tp_monthly.nc" # In[2]: import os import pandas as pd import xarray as xr # In[4]: # read the station data df = pd.read_csv(os.path.join(stationdir, name_station)) # In[5]: df.head(10) # You can see that the data structure is very simple, first 4 rows contain the station information, and the rest is the Time and precipitation measurement # In[6]: #read the predictor data = xr.open_dataset(os.path.join(predictordir, filename_predictor)) # In[7]: data # Here, the ERA5 dataset we loaded is a global datasets with the tp as the variable name, which is provided in the predictors list. We can even plot the global datasets for on time step # In[9]: data.tp.sel(time="1950-01-01").plot()