build_natura_raster: Fix snakemake specifics
This commit is contained in:
parent
70857f955c
commit
8f171396cb
@ -1,16 +1,17 @@
|
|||||||
|
import numpy as np
|
||||||
import atlite
|
import atlite
|
||||||
from osgeo import gdal
|
from osgeo import gdal
|
||||||
import geokit as gk
|
import geokit as gk
|
||||||
|
|
||||||
def determine_cutout_xXyY(cutout_name):
|
def determine_cutout_xXyY(cutout_name):
|
||||||
cutout = atlite.Cutout(cutout_name, cutout_dir="../cutouts")
|
cutout = atlite.Cutout(cutout_name, cutout_dir="cutouts")
|
||||||
x, X, y, Y = cutout.extent
|
x, X, y, Y = cutout.extent
|
||||||
dx = (X - x) / (cutout.shape[1] - 1)
|
dx = (X - x) / (cutout.shape[1] - 1)
|
||||||
dy = (Y - y) / (cutout.shape[0] - 1)
|
dy = (Y - y) / (cutout.shape[0] - 1)
|
||||||
return [x - dx/2., X + dx/2., y - dy/2., Y + dy/2.]
|
return [x - dx/2., X + dx/2., y - dy/2., Y + dy/2.]
|
||||||
|
|
||||||
cutout_names = np.unique([res['cutout'] for res in config['renewable'].values()])
|
cutout_names = np.unique([res['cutout'] for res in snakemake.config['renewable'].values()])
|
||||||
xs, Xs, ys, Ys = zip(*(determine_cutout_xyXY(cutout) for cutout in cutout_names))
|
xs, Xs, ys, Ys = zip(*(determine_cutout_xXyY(cutout) for cutout in cutout_names))
|
||||||
xXyY = min(xs), max(Xs), min(ys), max(Ys)
|
xXyY = min(xs), max(Xs), min(ys), max(Ys)
|
||||||
|
|
||||||
natura = gk.vector.loadVector(snakemake.input[0])
|
natura = gk.vector.loadVector(snakemake.input[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user