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

Implemented using DEM slope and aspect.

parent 2f26c6e0
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ if __name__ == '__main__': ...@@ -53,7 +53,7 @@ if __name__ == '__main__':
LogConfig.init_log('Initializing ERA5 predictors.') LogConfig.init_log('Initializing ERA5 predictors.')
Era5 = ERA5Dataset(ERA5_PATH.joinpath('ERA5'), ERA5_PREDICTORS, Era5 = ERA5Dataset(ERA5_PATH.joinpath('ERA5'), ERA5_PREDICTORS,
plevels=ERA5_PLEVELS) plevels=ERA5_PLEVELS)
Era5_ds = Era5.merge() Era5_ds = Era5.merge(chunks=-1)
# whether to use digital elevation model # whether to use digital elevation model
if DEM: if DEM:
...@@ -63,9 +63,10 @@ if __name__ == '__main__': ...@@ -63,9 +63,10 @@ if __name__ == '__main__':
# read elevation and compute slope and aspect # read elevation and compute slope and aspect
dem = ERA5Dataset.dem_features(dem, {'time': Era5_ds.time}) dem = ERA5Dataset.dem_features(dem, {'time': Era5_ds.time})
# check wether to use slope and aspect # read elevation and compute slope and aspect
if not DEM_FEATURES: dem = ERA5Dataset.dem_features(
dem = dem.drop_vars(['slope', 'aspect']) dem, {'y': Era5_ds.y, 'x': Era5_ds.x},
add_coord={'time': Era5_ds.time})
# add dem to set of predictor variables # add dem to set of predictor variables
Era5_ds = xr.merge([Era5_ds, dem]) Era5_ds = xr.merge([Era5_ds, dem])
......
...@@ -61,7 +61,7 @@ if __name__ == '__main__': ...@@ -61,7 +61,7 @@ if __name__ == '__main__':
LogConfig.init_log('Initializing ERA5 predictors.') LogConfig.init_log('Initializing ERA5 predictors.')
Era5 = ERA5Dataset(ERA5_PATH.joinpath('ERA5'), ERA5_PREDICTORS, Era5 = ERA5Dataset(ERA5_PATH.joinpath('ERA5'), ERA5_PREDICTORS,
plevels=ERA5_PLEVELS) plevels=ERA5_PLEVELS)
Era5_ds = Era5.merge() Era5_ds = Era5.merge(chunks=-1)
# initialize OBS predictand dataset # initialize OBS predictand dataset
LogConfig.init_log('Initializing observations for predictand: {}' LogConfig.init_log('Initializing observations for predictand: {}'
...@@ -86,14 +86,15 @@ if __name__ == '__main__': ...@@ -86,14 +86,15 @@ if __name__ == '__main__':
dem = search_files(DEM_PATH, '^eu_dem_v11_stt.nc$').pop() dem = search_files(DEM_PATH, '^eu_dem_v11_stt.nc$').pop()
# read elevation and compute slope and aspect # read elevation and compute slope and aspect
dem = ERA5Dataset.dem_features(dem, {'time': Era5_ds.time}) dem = ERA5Dataset.dem_features(
dem, {'y': Era5_ds.y, 'x': Era5_ds.x},
add_coord={'time': Era5_ds.time})
# check wether to use slope and aspect # check wether to use slope and aspect
if not DEM_FEATURES: if not DEM_FEATURES:
dem = dem.drop_vars(['slope', 'aspect']) dem = dem.drop_vars(['slope', 'aspect'])
# add dem to set of predictor variables # add dem to set of predictor variables
LOGGER.info('HI')
Era5_ds = xr.merge([Era5_ds, dem]) Era5_ds = xr.merge([Era5_ds, dem])
# initialize training data # initialize training data
......
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