Skip to content
Snippets Groups Projects
Commit 01a2b8c7 authored by Aiko Voigt's avatar Aiko Voigt
Browse files

Adds example calculatio of Pv potential for exercise on 2024-10-22; updates Readme

parent 2e9913d5
No related branches found
No related tags found
No related merge requests found
.ipynb_checkpoints/
*/.ipynb_checkpoints/ */.ipynb_checkpoints/
...@@ -2,5 +2,14 @@ ...@@ -2,5 +2,14 @@
Git repo for the exercises. Git repo for the exercises.
The directory `organisational` contains information on the content of the exercises and to get started with the data analysis. Directory structure:
* `organisational`: information on the content of the exercises and to get started with the data analysis
* `python-kernel`: create python kernel on IMG Teachinghub via the Masterhub access, using the account avoigt
* `era5-download`: scripts to retrieve ERA5 and ERA5-Land data from the Copernicus Data Store
* `analysis`: scripts to calculate PV potential etc.
Notes for Aiko Voigt:
* The ERA5 and ERA5-Land download scripts need to be executed logged in as avoigt to the Masterhub via wolke.img.univie.ac.at. The data will be put in a directory only accessible to avoigt.
* Then, the data can be copied to `/stufs/lehre/msc-intro-comp-met-ex-w2024/data/`. There, it is accessible to everybody logged in via the Moodle Teachinghub under `LEHRE/msc-intro-comp-met-ex-w2024/data/`.
%% Cell type:markdown id:7d41920d-ccc6-4657-bacc-19006b87d7b8 tags:
# Example calculation of PV potential for ERA5 data
%% Cell type:code id:99875287-2b84-460f-9c90-2e2542ff4e9b tags:
``` python
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
```
%% Cell type:code id:1f4067af-2ee7-43f5-b43d-94739e229f5c tags:
``` python
# location of era5 data on teachinghub
path="/home/voigta80/LEHRE/msc-intro-comp-met-ex-w2024/data/era5/"
```
%% Cell type:markdown id:a2c87dd8-340b-4487-a4a0-e3d4c6dbc9aa tags:
Load data for Jan and Feb 1979.
%% Cell type:code id:daf3daff-d39d-4a49-8c13-3ffba150a8b4 tags:
``` python
ds=xr.open_mfdataset([path+"era5-1979-01.nc", path+"era5-1979-02.nc"])
```
%% Cell type:markdown id:8af1d101-3f38-42b9-9f9d-f47c37b660f3 tags:
Calculate wind speed.
%% Cell type:code id:07374d0b-6a20-4027-9b78-65e59b26b959 tags:
``` python
ds["wspd"] = np.sqrt(np.power(ds["u10"],2)+np.power(ds["v10"],2))
```
%% Cell type:markdown id:c484d2f8-130c-45b8-a741-e118f58726c1 tags:
Calculate PV potential following Jerez et al. 2015, https://www.nature.com/articles/ncomms10014.
**Note:** radiative fluxes are accumulated over 1 hour, so we need to divided by seconds per hour to obtain fluxes in Wm-2.
%% Cell type:code id:447d7b3b-957c-44a2-abae-72e6ef3a1ec7 tags:
``` python
sechour=3600 # secondd per hour
c1 = 4.3
c2 = 0.943
c3 = 0.028
c4 = -1.528
# cell temperature
T_cell = c1 + c2 * (ds.t2m - 273.15) + c3 * ds.ssrd/sechour + c4 * ds.wspd
# performance ratio
beta = -0.005
p_r = 1 + beta*(T_cell-25)
# pv potential
pv_pot = p_r * ds.ssrd/(sechour) * 1/1000
```
%% Cell type:markdown id:036de419-2716-4ead-bd94-1d551b03b29c tags:
Calculate time-mean PV potential and plot as a map.
%% Cell type:code id:3bc58d12-7d2d-45ae-996b-e18764af4889 tags:
``` python
pv_pot_tmean = pv_pot.mean("valid_time").compute()
```
%% Cell type:code id:65dc280c-78e0-483f-833e-9b32df81c728 tags:
``` python
plt.contourf(ds.longitude, ds.latitude, pv_pot_tmean)
plt.colorbar()
```
%% Output
<matplotlib.colorbar.Colorbar at 0x7f841d6a3130>
%% Cell type:code id:70cc5656-f511-437c-bddf-73ea620d37ca tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment