Skip to content

Commit

Permalink
Merge pull request #45 from lukasValentin/dev
Browse files Browse the repository at this point in the history
Bump EOdal `v0.2.0`
  • Loading branch information
lukasValentin authored Apr 3, 2023
2 parents 4109747 + 2294010 commit 8a0403f
Show file tree
Hide file tree
Showing 52 changed files with 991 additions and 931 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ The format is based on `Keep a Changelog`_, and this project adheres to `Semanti

Categories for changes are: Added, Changed, Deprecated, Removed, Fixed, Security.

Version `0.2.0 < https://github.com/EOA-team/eodal/releases/tag/v0.2.0>`__
--------------------------------------------------------------------------------

Release date: 2023-04-03

- Added: the new EOdal Mapper class has been fully implemented and replaces the old mapper version. Scripts calling the Mapper must be updated.
- Removed: the previous EOdal Mapper class. The enitre eodal.operational sub-package has been deprecated.
- Removed: the sub-package called eodal.operational.cli has been deprecated. Some useful scripts have been ported to the `scripts` folder in the main directory of the EOdal git repository.
- Changed: The EOdal pystac client has been re-designed to provide a higher level of generalization. Still, future changes might apply.
- Fixed: SceneCollection.get_feature_timeseries() had several bugs. Thanks to @atoparseks the code has been cleaned up, made simpler and works now with custom functions for computing user-defined zonal statistical metrics.
- Fixed: Several small bugs in the core module with varying levels of severity.
- Fixed: The map algebra operators for Band and RasterCollection objects lacked support of right-handed sided expression (e.g., `2 + Band` instead of `Band +2`). This issue has been fixed by overwriting also the [r]ight-handed built-in operators such `radd` as the right-handed equivalent of `add`.
- Changed: The README has been updated and now also includes information about the data model in EOdal.

Version `0.1.1 < https://github.com/EOA-team/eodal/releases/tag/v0.1.1>`__
--------------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion eodal/__meta__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# `name` is the name of the package as used for `pip install package`
name = "eodal"
# `path` is the name of the package for `import package`
Expand Down
9 changes: 4 additions & 5 deletions eodal/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ class Settings(BaseSettings):
# define Planet-API token
PLANET_API_KEY: str = ""
# Planet API URLs
ORDERS_URL: str = 'https://api.planet.com/compute/ops/orders/v2'
DATA_URL: str = 'https://api.planet.com/data/v1'

ORDERS_URL: str = "https://api.planet.com/compute/ops/orders/v2"
DATA_URL: str = "https://api.planet.com/data/v1"

# metadata base connection details
DB_USER: str = "postgres"
Expand All @@ -89,10 +88,10 @@ class Settings(BaseSettings):
LIMIT_ITEMS: int = 5

# change the value of this variable to use a different STAC service provider
STAC_BACKEND: Any = STAC_Providers.MSPC # STAC_Providers.AWS
STAC_BACKEND: Any = STAC_Providers.MSPC # STAC_Providers.AWS

# subscription key for MS-PC (might be required for some data sets like Sentinel-1)
PC_SDK_SUBSCRIPTION_KEY: str = ''
PC_SDK_SUBSCRIPTION_KEY: str = ""

# path to custom CA_BUNDLE when calling the pystac_client behind a proxy server
# when a path a custom certificate is required set this variable to a path
Expand Down
9 changes: 5 additions & 4 deletions eodal/config/stac_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ class MSPC:
URL: str = "https://planetarycomputer.microsoft.com/api/stac/v1"
S2Level_1C: str = "sentinel-2-l1c"
S2Level_2A: str = "sentinel-2-l2a"
S1RTC: str = "sentinel-1-rtc" # radiometric and terrain corrected using PlanetDEM (IW mode)
S1GRD: str = "sentinel-1-grd" # corrected to ground range using ellipsoid model WGS84

S1RTC: str = "sentinel-1-rtc" # radiometric and terrain corrected using PlanetDEM (IW mode)
S1GRD: str = (
"sentinel-1-grd" # corrected to ground range using ellipsoid model WGS84
)

class Sentinel2:
product_uri: str = "id"
scene_id: str = "s2:granule_id"
Expand All @@ -64,4 +66,3 @@ class Sentinel2:
epsg: str = "proj:epsg"
sun_zenith_angle = "s2:mean_solar_zenith"
sun_azimuth_angle = "s2:mean_solar_azimuth"

20 changes: 12 additions & 8 deletions eodal/core/algorithms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'''
"""
Collection of algorithms working with EOdal core objects such as Bands,
RasterCollections, Scenes and SceneCollections.
Expand All @@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
"""
from __future__ import annotations

import eodal
Expand All @@ -35,6 +35,7 @@

Settings = get_settings()


def _get_crs_and_attribs(
in_file: Path, **kwargs
) -> Tuple[GeoInfo, List[Dict[str, Any]]]:
Expand All @@ -56,6 +57,7 @@ def _get_crs_and_attribs(
attrs = [ds[x].get_attributes() for x in ds.band_names]
return geo_info, attrs


def merge_datasets(
datasets: List[Path],
out_file: Optional[Path] = None,
Expand Down Expand Up @@ -141,8 +143,10 @@ def merge_datasets(
if sensor is None:
raster = RasterCollection(scene_properties=scene_properties)
else:
raster = eval(f'eodal.core.sensors.{sensor.lower()}.{sensor[0].upper() + sensor[1::]}' \
+ '(scene_properties=scene_properties)')
raster = eval(
f"eodal.core.sensors.{sensor.lower()}.{sensor[0].upper() + sensor[1::]}"
+ "(scene_properties=scene_properties)"
)
n_bands = out_ds.shape[0]
# take attributes of the first dataset
attrs = attrs_list[0]
Expand Down Expand Up @@ -170,18 +174,18 @@ def merge_datasets(
unit = unit[0]

# get band name and alias if provided
band_name = band_options.get('band_names', f'B{idx+1}')
band_name = band_options.get("band_names", f"B{idx+1}")
if isinstance(band_name, list):
if len(band_name) == n_bands:
band_name = band_name[idx]
else:
band_name = f'B{idx+1}'
band_alias = band_options.get('band_aliases', f'B{idx+1}')
band_name = f"B{idx+1}"
band_alias = band_options.get("band_aliases", f"B{idx+1}")
if isinstance(band_alias, list):
if len(band_alias) == n_bands:
band_alias = band_alias[idx]
else:
band_alias = f'B{idx+1}'
band_alias = f"B{idx+1}"

raster.add_band(
band_constructor=Band,
Expand Down
Loading

0 comments on commit 8a0403f

Please sign in to comment.