Skip to content

Commit

Permalink
Merge pull request #7 from earthnet2021/sen2nbar
Browse files Browse the repository at this point in the history
changed to sen2nbar
  • Loading branch information
vitusbenson authored Mar 22, 2023
2 parents ea3acdd + d8846ec commit 4607785
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 664 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Kwargs:
- `five_daily_filter`: If `True` returns a regular 5-daily cycle starting with the first date in `full_time_interval`. It has no effect, if `best_orbit_filter` is used.
- `brdf_correction`: If `True`, does BRDF correction based on the Sentinel 2 Metadata (illumination angles).
- `cloud_mask`: If `True`, creates a cloud and cloud shadow mask based on deep learning. It automatically finds the best available cloud mask for the requested `bands`.
- `correct_processing_baseline`: If `True` (default): corrects the shift of +1000 that exists in Sentinel 2 data with processing baseline >= 4.0


## Installation
Expand All @@ -105,7 +106,7 @@ conda create -n minicuber python=3.10 gdal cartopy -c conda-forge
conda deactivate
conda activate minicuber
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install scipy matplotlib seaborn netCDF4 xarray zarr dask shapely pillow pandas s3fs fsspec boto3 psycopg2 pystac-client stackstac planetary-computer rasterio[s3] rioxarray odc-algo segmentation-models-pytorch folium ipykernel ipywidgets
pip install scipy matplotlib seaborn netCDF4 xarray zarr dask shapely pillow pandas s3fs fsspec boto3 psycopg2 pystac-client stackstac planetary-computer rasterio[s3] rioxarray odc-algo segmentation-models-pytorch folium ipykernel ipywidgets sen2nbar
```

Install this package with PyPI:
Expand Down Expand Up @@ -134,4 +135,4 @@ Similar to this package, [cubo](https://github.com/davemlz/cubo) provides a high

## Acknowledgement

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 101004188 ([DeepCube Horizon 2020](https://deepcube-h2020.eu/ "DeepCube Horizon 2020")). We are grateful to David Montero Loaiza for providing the code for the Sentinel 2 BRDF correction. We are grateful to César Aybar and the [CloudSEN12](https://cloudsen12.github.io/) team, their work forms the basis for the cloud mask implemented in earthnet-minicuber.
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 101004188 ([DeepCube Horizon 2020](https://deepcube-h2020.eu/ "DeepCube Horizon 2020")). We are grateful to David Montero Loaiza for providing the [sen2nbar](https://github.com/ESDS-Leipzig/sen2nbar) package used for the Sentinel 2 BRDF correction. We are grateful to César Aybar and the [CloudSEN12](https://cloudsen12.github.io/) team, their work forms the basis for the cloud mask implemented in earthnet-minicuber.
2 changes: 1 addition & 1 deletion earthnet_minicuber/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""EarthNet Minicuber"""

__version__ = "0.1.1"
__version__ = "0.1.2"
__author__ = "Vitus Benson"


Expand Down
2 changes: 1 addition & 1 deletion earthnet_minicuber/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ def plot_rgb(mc, mask = True):
if mask:
return mc[["s2_B04", "s2_B03", "s2_B02"]].to_array("band").where(((mc.s2_mask < 1) & mc.s2_SCL.isin([1,2,4,5,6,7]))).plot.imshow(col = "time", col_wrap = 3, vmin = 0.0, vmax = 0.4)
else:
return mc[["s2_B04", "s2_B03", "s2_B02"]].to_array("band").where(((mc.s2_mask < 1)), np.NaN).plot.imshow(col = "time", col_wrap = 3, vmin = 0.0, vmax = 0.4)
return mc[["s2_B04", "s2_B03", "s2_B02"]].to_array("band").plot.imshow(col = "time", col_wrap = 3, vmin = 0.0, vmax = 0.4)
10 changes: 7 additions & 3 deletions earthnet_minicuber/provider/era5_esdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@

class ERA5_ESDL(provider_base.Provider):

def __init__(self, bands = ['e', 'pet', 'pev', 'ssrd', 't2m', 't2mmax', 't2mmin','tp'], zarrpath = None):
def __init__(self, bands = ['e', 'pet', 'pev', 'ssrd', 't2m', 't2mmax', 't2mmin','tp'], zarrpath = None, proxy = None):
self.is_temporal = True

self.bands = bands
self.zarrpath = zarrpath

if zarrpath is not None:
if zarrpath is None:
self.s3 = s3fs.S3FileSystem(anon=True,
client_kwargs={
'endpoint_url': 'https://s3.bgc-jena.mpg.de:9000',
'region_name': 'thuringia',
})
},
config_kwargs = {
"proxies": {'http': proxy}
} if proxy else {}
)

def load_data(self, bbox, time_interval, **kwargs):

Expand Down
2 changes: 1 addition & 1 deletion earthnet_minicuber/provider/s2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

from . import sentinel2, nbar, cloudmask, utils, sen2flux
from . import sentinel2, nbar, cloudmask
Loading

0 comments on commit 4607785

Please sign in to comment.