Skip to content

Commit

Permalink
Merge pull request #66 from WorldCereal/seasons
Browse files Browse the repository at this point in the history
Seasons
  • Loading branch information
kvantricht authored Jun 20, 2024
2 parents 1c1c483 + 5d1ceab commit 8fbc9b6
Show file tree
Hide file tree
Showing 17 changed files with 530 additions and 223 deletions.
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ tmp
*.tfevents
*.nc
*.gif
data
config.json
features*.zarr
# C extensions
*.so
*.gz
# Distribution / packaging
.Python
data
build/
develop-eggs/
dist/
Expand Down Expand Up @@ -69,17 +66,17 @@ pip-delete-this-directory.txt
*.aux.xml

# Allow crop calendar resources to be tracked
!/src/worldcereal/resources/cropcalendars/*.tif
!/src/worldcereal/data/cropcalendars/*.tif

# Allow resource CSV files to be tracked
!/src/worldcereal/resources/*.csv
# !/src/worldcereal/resources/*.csv

# Allow resource JSON files to be tracked
!/src/worldcereal/resources/**/*.json
# !/src/worldcereal/resources/**/*.json

# Allow biomes/realms to be tracked
!/src/worldcereal/resources/biomes/*.tif
!/src/worldcereal/resources/realms/*.tif
# !/src/worldcereal/resources/biomes/*.tif
# !/src/worldcereal/resources/realms/*.tif

# Dont track zarr data
features.zarr/
Expand Down
16 changes: 11 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.sdist]
Expand All @@ -11,9 +11,12 @@ exclude = [
"/tests",
]

[tool.hatch.version]
path = "src/worldcereal/_version.py"
pattern = "^__version__ = ['\"](?P<version>[^'\"]+)['\"]$"

[project]
name = "worldcereal"
version = "2.0.1"
authors = [
{ name="Kristof Van Tricht" },
{ name="Jeroen Degerickx" },
Expand All @@ -22,7 +25,8 @@ authors = [
]
description = "WorldCereal classification module"
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.8"
dynamic = ["version"]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
Expand All @@ -32,12 +36,14 @@ dependencies = [
"xarray>=2022.3.0",
"rioxarray>=0.13.0",
"loguru>=0.7.2",
"h5netcdf>=1.2.0",
"geojson",
"numpy<2.0.0",
"h5netcdf>=1.1.0",
"openeo>=0.29.0",
"cftime",
"pytest-depends",
"pyarrow",
"pandas"]
"geopandas"]

[project.urls]
"Homepage" = "https://github.com/WorldCereal/worldcereal-classification"
Expand Down
35 changes: 13 additions & 22 deletions src/worldcereal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#!/usr/bin/env python3

from ._version import __version__
from .utils.spatial import BoundingBoxExtent

__all__ = ["__version__", "BoundingBoxExtent"]

SUPPORTED_SEASONS = [
"tc-wintercereals",
"tc-maize-main",
"tc-maize-second",
"tc-s1",
"tc-s2",
"tc-annual",
"custom",
]

SEASONAL_MAPPING = {
"tc-wintercereals": "WW",
"tc-maize-main": "M1",
"tc-maize-second": "M2",
"tc-s1": "S1",
"tc-s2": "S2",
"tc-annual": "ANNUAL",
"custom": "custom",
}
Expand All @@ -20,9 +23,8 @@
# Default buffer (days) prior to
# season start
SEASON_PRIOR_BUFFER = {
"tc-wintercereals": 15,
"tc-maize-main": 15,
"tc-maize-second": 15,
"tc-s1": 0,
"tc-s2": 0,
"tc-annual": 0,
"custom": 0,
}
Expand All @@ -31,19 +33,8 @@
# Default buffer (days) after
# season end
SEASON_POST_BUFFER = {
"tc-wintercereals": 0,
"tc-maize-main": 0,
"tc-maize-second": 0,
"tc-s1": 0,
"tc-s2": 0,
"tc-annual": 0,
"custom": 0,
}


# Base temperatures used for
# crop-specific GDD accumulation
TBASE = {"tc-wintercereals": 0, "tc-maize-main": 10, "tc-maize-second": 10}


# Upper limit temperatures for
# GDD accumulation
GDDTLIMIT = {"tc-wintercereals": 25, "tc-maize-main": 30, "tc-maize-second": 30}
11 changes: 0 additions & 11 deletions src/worldcereal/__main__.py

This file was deleted.

3 changes: 3 additions & 0 deletions src/worldcereal/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env python3

__version__ = "2.0.2"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Loading

0 comments on commit 8fbc9b6

Please sign in to comment.