Skip to content
Snippets Groups Projects
Commit d1d73f78 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Preliminary validation metrics for temperature.

parent 87e4e1b8
No related branches found
No related tags found
No related merge requests found
Showing with 2 additions and 7 deletions
Notebooks/Figures/tasmax_average_bias.png

351 KiB

Notebooks/Figures/tasmax_average_bias_p98.png

345 KiB

Notebooks/Figures/tasmax_average_bias_seasonal.png

337 KiB

Notebooks/Figures/tasmax_mean_annual_cycle.png

303 KiB

Notebooks/Figures/tasmax_r2.png

518 KiB

Notebooks/Figures/tasmin_average_bias.png

335 KiB

Notebooks/Figures/tasmin_average_bias_extreme.png

322 KiB

Notebooks/Figures/tasmin_average_bias_p2.png

336 KiB

Notebooks/Figures/tasmin_average_bias_seasonal.png

326 KiB

Notebooks/Figures/tasmin_mean_annual_cycle.png

267 KiB

Notebooks/Figures/tasmin_r2.png

485 KiB

%% Cell type:markdown id:4735431f-6741-437e-b0fc-dd6d8eaa22ca tags:
# Evaluate ERA-5 downscaling
%% Cell type:markdown id:a87da113-4b0f-4ac8-9721-19c85848acec tags:
We used **1981-1991 as training** period and **1991-2010 as reference** period. The results shown in this notebook are based on the model predictions on the reference period.
%% Cell type:markdown id:f9334da7-17d1-45ef-9ed9-5c2bee9fcdcc tags:
Define the predictand and the model to evaluate:
%% Cell type:code id:a81acde7-16a2-4087-bc08-95b084adbd06 tags:
``` python
# define the model parameters
PREDICTAND = 'pr'
MODEL = 'USegNet'
PPREDICTORS = 'ztuvq'
PLEVELS = ['500', '850']
SPREDICTORS = 'pt2'
DEM = 'dem'
DOY = 'doy'
```
%% Cell type:markdown id:dd188df0-69ee-44b0-82b2-d212994dc271 tags:
### Imports
%% Cell type:code id:06792bf2-b33b-4728-ba60-d60fab46779d tags:
``` python
# builtins
import datetime
import warnings
import calendar
# externals
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
from IPython.display import Image
# locals
from climax.main.io import ERA5_PATH, OBS_PATH, TARGET_PATH
from pysegcnn.core.utils import search_files
```
%% Cell type:markdown id:a3d92474-2bc1-4035-8938-c5fbb07ae891 tags:
### Model architecture
%% Cell type:code id:c68e022b-41c2-438b-bfb0-e27eddee89bf tags:
``` python
Image("./Figures/architecture.png", width=900, height=400)
```
%% Cell type:markdown id:5a0c55f0-79fb-4501-b3cf-b5414399a3d9 tags:
### Load datasets
%% Cell type:code id:a5db133d-2c36-4e84-879e-20e617e821f1 tags:
``` python
# model predictions and observations NetCDF
y_pred = TARGET_PATH.joinpath(PREDICTAND, '_'.join([MODEL, PREDICTAND, PPREDICTORS, *PLEVELS, SPREDICTORS, DEM, DOY]) + '.nc')
if PREDICTAND == 'tas':
# read both tasmax and tasmin
tasmax = xr.open_dataset(search_files(OBS_PATH.joinpath('tasmax'), '.nc$').pop())
tasmin = xr.open_dataset(search_files(OBS_PATH.joinpath('tasmin'), '.nc$').pop())
y_true = xr.merge([tasmax, tasmin])
else:
y_true = xr.open_dataset(search_files(OBS_PATH.joinpath(PREDICTAND), '.nc$').pop())
y_true = xr.open_dataset(search_files(OBS_PATH.joinpath(PREDICTAND), '.nc$').pop())
```
%% Cell type:code id:528c3116-7707-45ca-b811-0adad7bc20f3 tags:
``` python
# load datasets
y_pred = xr.open_dataset(y_pred)
y_true = y_true.sel(time=y_pred.time) # subset to time period covered by predictions
```
%% Cell type:code id:70b903cb-e597-45d3-b575-0ebaf7a45649 tags:
``` python
# align datasets and mask missing values in model predictions
y_true, y_pred = xr.align(y_true, y_pred, join='override')
y_pred = y_pred.where(~np.isnan(y_true), other=np.nan)
```
%% Cell type:markdown id:b269a131-cf5b-4c6c-9f8e-a5408250aa83 tags:
## Model validation: precipitation
%% Cell type:code id:03ada1be-ae1a-4cdc-b396-e3bbc8f8a7ed tags:
``` python
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment