mirror of
https://github.com/heyarne/earth-observation-for-journalism.git
synced 2026-05-06 19:13:40 +02:00
Finish pipeline for True-Colo products!
This commit is contained in:
parent
863160f727
commit
72efc4d8e4
8 changed files with 3669 additions and 8532 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -8,7 +8,7 @@
|
||||||
*.tif.aux.xml
|
*.tif.aux.xml
|
||||||
*.tiff.aux.xml
|
*.tiff.aux.xml
|
||||||
*.zip
|
*.zip
|
||||||
*.SAFE/*
|
**/*.SAFE/*
|
||||||
|
|
||||||
.jupyter
|
.jupyter
|
||||||
.local
|
.local
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -469,7 +469,14 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"We want to take the product that has the biggest intersection area with our region of interest:"
|
"Because downloads are large, we skip unnecessary downloads wherever possible.\n",
|
||||||
|
"\n",
|
||||||
|
"- For this particular example we can select exactly one\n",
|
||||||
|
"- \n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"- Select biggest intersection area\n",
|
||||||
|
"- Figure out which tiles are needed \n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
2742
true-color-image/01c Brandenburg Mosaic.ipynb
Normal file
2742
true-color-image/01c Brandenburg Mosaic.ipynb
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -111,10 +111,15 @@ def scihub_bgr_paths(raster_path, resolution=None):
|
||||||
|
|
||||||
|
|
||||||
def scihub_normalize_range(v):
|
def scihub_normalize_range(v):
|
||||||
|
'''
|
||||||
|
Raster files downloaded from the Copernicus Open Access Hub can contain
|
||||||
|
pixels with reflectance values outside of the allowed range. This function
|
||||||
|
discards those values and normalizes the range of the returned raster file
|
||||||
|
to be [0...1].
|
||||||
|
'''
|
||||||
return np.clip(v, 0, 2000) / 2000
|
return np.clip(v, 0, 2000) / 2000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def reproject_raster_image(src, dst, target_crs):
|
def reproject_raster_image(src, dst, target_crs):
|
||||||
'''
|
'''
|
||||||
Reprojects `src` into `dst`, given a coordinate reference system `target_crs`.
|
Reprojects `src` into `dst`, given a coordinate reference system `target_crs`.
|
||||||
|
|
@ -139,3 +144,28 @@ def reproject_raster_image(src, dst, target_crs):
|
||||||
dst_transform=transform,
|
dst_transform=transform,
|
||||||
dst_crs=target_crs,
|
dst_crs=target_crs,
|
||||||
resampling=Resampling.nearest)
|
resampling=Resampling.nearest)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: This is documented somewhere in the python docs, we should link to it here
|
||||||
|
|
||||||
|
class RasterReaderList():
|
||||||
|
'''
|
||||||
|
This class allows opening a list of file paths in a `with` block using
|
||||||
|
rasterio.open. They get automatically closed when the context created by
|
||||||
|
the `with` block is left.
|
||||||
|
'''
|
||||||
|
|
||||||
|
def __init__(self, paths):
|
||||||
|
self.open_files = []
|
||||||
|
self.paths = paths
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
for f in self.paths:
|
||||||
|
self.open_files.append(r.open(f))
|
||||||
|
|
||||||
|
return self.open_files
|
||||||
|
|
||||||
|
def __exit__(self, _type, _value, _traceback):
|
||||||
|
for f in self.open_files:
|
||||||
|
f.close()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue