Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# CHANGELOG


## [Unreleased]

### New

- Level 2 supports any continent (not just europe). Multiple continents are still not supported

### Fixed

- STAC catalog is generated in output root ("l2-ard") and not in "l2-ard/europe" subdirectory
20 changes: 16 additions & 4 deletions bin/force-level2-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,19 @@ gen-stac() {
uv run --project /opt/force-python-tools --no-sync gen-stac "$@"
}

# TODO instead of hardcoded europe, generate stac for each continent
mv outputs/l2-ard/CITEME* outputs/l2-ard/europe/

gen-stac outputs/l2-ard/europe --output-path outputs/l2-ard/europe --item-id "$processing_name-level2" --type level2
# FIXME this generates a stac item for each continent, but a single catalog per item which will be overwritten by each iteration
# Hence, only a single continent is supported. However, it solves the previous issue, that only
# europe as a continent is supported.
# TODO Furthermore, neither of the existing solutions has been tested with procjection other than GLANCE7, so it
# must be checked whether other projections also generate subdirectories.

for dir in outputs/l2-ard/*/; do
continent_dir="${dir%/}"
continent_dir="${continent_dir##*/}"
echo "continent: $continent_dir"
cp outputs/l2-ard/CITEME* "outputs/l2-ard/$continent_dir/"
mkdir -p "outputs/l2-ard/$continent_dir/param"
cp param/l2ps.prm "outputs/l2-ard/$continent_dir/param/l2ps.prm"

gen-stac "outputs/l2-ard/$continent_dir" --output-path "$(realpath "outputs/l2-ard/")" --item-id "$processing_name-$continent_dir-level2" --type "level2" --parameter-path "outputs/l2-ard/$continent_dir/param/l2ps.prm"
done
2 changes: 1 addition & 1 deletion cwl/docker-requirement.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
quay.io/bcdev/force-eoap:0.5.6
quay.io/bcdev/force-eoap:0.5.7-dev4
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"

[project]
name = "force-python-utils"
version = "0.5.6"
version = "0.5.7-dev4"
requires-python = ">= 3.10"
dependencies = [
"click>=8.3.3",
"click>=8.4.1",
"geopandas>=1.1.3",
"py-multihash>=3.0.0",
"pystac[validation]>=1.14.3",
Expand Down
1 change: 1 addition & 0 deletions python/src/force_utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def gen_stac(datacube_root, output_path, item_id, type, parameter_path, validate
)
catalog = stac_builder.generate_stac(item_id=item_id)
catalog.normalize_hrefs(str(output_path))
catalog.make_all_asset_hrefs_relative()
if validate:
catalog.validate_all()
logger.info(f"Saving STAC catalog to {output_path.resolve()}")
Expand Down
10 changes: 4 additions & 6 deletions python/src/force_utils/contributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,23 +485,22 @@ def process_store(
cls.process_parameter_file(parameter_path, store, item=item)

# datacube-definition.prj
data_cube_definition_local_path = store.data_cube_definition_path.name
data_cube_definition_asset = pystac.Asset(
href=data_cube_definition_local_path,
href=str(store.data_cube_definition_path),
title="Data Cube Definition",
media_type=pystac.MediaType.TEXT,
roles=["metadata"],
# TODO
# decription = ...,
)
data_cube_definition_asset.ext.file.local_path = data_cube_definition_local_path
data_cube_definition_asset.ext.file.local_path = store.data_cube_definition_path.name
item.add_asset("datacube-definition.prj", data_cube_definition_asset)

# citeme
citeme_local_path = store.get_relative_path(store._citeme_path)
if citeme_local_path is not None:
citeme_asset = pystac.Asset(
href=str(citeme_local_path),
href=str(store._citeme_path),
title="CITEME",
media_type=pystac.MediaType.TEXT,
roles=["metadata"],
Expand Down Expand Up @@ -541,9 +540,8 @@ def process_parameter_file(
item.properties[key][param_name] = param_value

try:
parameter_path_relative = store.get_relative_path(parameter_path)
parameter_asset = pystac.Asset(
href=str(parameter_path_relative),
href=str(parameter_path),
title="FORCE parameter file",
media_type=pystac.MediaType.TEXT,
roles=["metadata"],
Expand Down
2 changes: 1 addition & 1 deletion python/src/force_utils/force_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def generate_stac(

asset_key = self._get_asset_key(tile, asset_path_relative)
asset = pystac.Asset(
href=str(asset_path_relative),
href=str(asset_path),
)
item.add_asset(asset_key, asset)

Expand Down
10 changes: 5 additions & 5 deletions python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/test_force_level2_cltool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cwltool \


# check that asset links can be found
cd "$outdir/l2-ard/europe" # must check relative paths in the assets from outdir
cd "$outdir/l2-ard" # must check relative paths in the assets from outdir
pwd
missing=0
find . -name 'cube-*.json' -print0 |
Expand Down
Loading