Research With Future Scenario#
Let us do some research now, with help of the CMIP6 dataset. We will look how our model fares with historical CMIP data and their climate models that predict future scenarios. I have setup some possible climate change models for you to use, you have to fill in your camel ID and think of a research question!
We like the sentence:
To understand [environment issue] in [region] we will study te impact of [verb/noun] on [hydrological variable].
But feel free to come up with your own! Some hints:
Maybe look at a smaller time period.
What do certain climate changes do to your region.
In This Notebook: Research with CMIP data#
In this notebook we will do the model runs for the chosen areas with the generated forcing from the previous notebook. This will be used to do our research with!
Importing and setting up#
# Ignore user warnings :)
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
# Required dependencies
import ewatercycle.forcing
import ewatercycle.observation.grdc
import ewatercycle.analysis
from pathlib import Path
from cartopy.io import shapereader
import pandas as pd
import numpy as np
from rich import print
import xarray as xr
import shutil
import json
import matplotlib.pyplot as plt
You can change the folder structure as well, but note that you will have to change that in upcoming notebooks as well!
# Load settings
# Read from the JSON file
with open("settings.json", "r") as json_file:
settings = json.load(json_file)
camel_id = settings["caravan_id"]
future_start_data = settings["future_start_date"]
future_end_data = settings["future_end_date"]
Enter your research here!#
I looked at the cumulative sum of the discharge as a simle example, up to you to implement your own!
# Load in the data again for the scenarios
# Open the output of the CMIP runs
xr_future = xr.open_dataset(Path(settings['path_output']) / (settings['caravan_id'] + '_future_output.nc'))
print(xr_future)
<xarray.Dataset> Size: 245kB Dimensions: (time: 7669) Coordinates: * time (time) datetime64[ns] 61kB 2029-01-0... Data variables: modelled discharge, forcing: SSP126 (time) float64 61kB ... modelled discharge, forcing: SSP245 (time) float64 61kB ... modelled discharge, forcing: SSP585 (time) float64 61kB ... Attributes: units: mm/d
# Specify the scenarios
SSP126_output = xr_future["modelled discharge, forcing: SSP126"]
SSP245_output = xr_future["modelled discharge, forcing: SSP245"]
SSP585_output = xr_future["modelled discharge, forcing: SSP585"]
# Change this to do what you want!
cum_sum_126 = np.cumsum(SSP126_output)
cum_sum_245 = np.cumsum(SSP245_output)
cum_sum_585 = np.cumsum(SSP585_output)
plt.plot(SSP126_output.time, cum_sum_126, label="SSP126")
plt.plot(SSP245_output.time, cum_sum_245, label="SSP245")
plt.plot(SSP585_output.time, cum_sum_585, label="SSP585")
plt.ylabel("Cumulative discharge [mm]")
plt.xlabel("Year")
plt.title(f"{settings["country"]}")
plt.grid()
plt.legend()
plt.show()