-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils_subdomains.py
34 lines (31 loc) · 1.03 KB
/
utils_subdomains.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
import pandas as pd
import os
PATH_DATA_SOURCE = os.path.join('resources')
LABELS = {
'FL': 'Flatlands',
'HA': 'High Alps',
'NMR': 'Northern Alpine Rim',
'SMR': 'Southern Alpine Rim',
}
def get_subdomains():
df = pd.read_csv(os.path.join(PATH_DATA_SOURCE, 'era5_altitudes.csv'))
df['subdomain'] = np.select(
[
(df['altitude'] >= 1200),
(df['altitude'] < 1200) & (df['altitude'] >= 500) & (df['longitude'] < 12) & (df['latitude'] >= 47),
(df['altitude'] < 1200) & (df['altitude'] >= 500) & (df['longitude'] >= 12) & (df['latitude'] >= 47.5),
(df['altitude'] < 1200) & (df['altitude'] >= 500) & (df['longitude'] < 12) & (df['latitude'] < 47),
(df['altitude'] < 1200) & (df['altitude'] >= 500) & (df['longitude'] >= 12) & (df['latitude'] < 47.5),
(df['altitude'] < 500),
],
[
'HA',
'NMR',
'NMR',
'SMR',
'SMR',
'FL',
]
)
return df