diff --git a/.github/workflows/build-push-docker_pr.yml b/.github/workflows/build-push-docker_pr.yml index b28b939..45e8fd9 100644 --- a/.github/workflows/build-push-docker_pr.yml +++ b/.github/workflows/build-push-docker_pr.yml @@ -13,7 +13,7 @@ jobs: run: echo "TAG=$(date +'%Y.%m.%d.%H.%M')" >> $GITHUB_ENV - uses: actions/setup-python@v1 with: - python-version: 3.9 + python-version: 3.11 - name: Install WHEEL tool run: pip install wheel - name: Build WHEEL file diff --git a/.github/workflows/build-push-docker_release.yml b/.github/workflows/build-push-docker_release.yml index 55431e5..18c1bcc 100644 --- a/.github/workflows/build-push-docker_release.yml +++ b/.github/workflows/build-push-docker_release.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: 3.11 - name: Install WHEEL tool run: pip install wheel - name: Build WHEEL file @@ -32,4 +32,4 @@ jobs: file: ./Dockerfile push: true tags: | - ${{ vars.GEOKUBE_REGISTRY }}/geokube:${{ env.TAG }} \ No newline at end of file + ${{ vars.GEOKUBE_REGISTRY }}/geokube:${{ env.RELEASE_TAG }} \ No newline at end of file diff --git a/.github/workflows/pypi_publish.yml b/.github/workflows/pypi_publish.yml index efcad79..bac4b25 100644 --- a/.github/workflows/pypi_publish.yml +++ b/.github/workflows/pypi_publish.yml @@ -7,10 +7,10 @@ on: jobs: build-and-publish: - name: Build Kit4DL and publish to PyPI + name: Build geokube package and publish to PyPI strategy: matrix: - python-version: ["3.9"] + python-version: ["3.11"] os: [ubuntu-latest] runs-on: ${{ matrix.os }} environment: release diff --git a/.github/workflows/testpypi_publish.yml b/.github/workflows/testpypi_publish.yml index 6979cac..e4966d1 100644 --- a/.github/workflows/testpypi_publish.yml +++ b/.github/workflows/testpypi_publish.yml @@ -10,11 +10,8 @@ jobs: name: Build geokube and publish to TestPyPI strategy: matrix: - python-version: ["3.9"] + python-version: ["3.11"] os: [ubuntu-latest] -# environment: -# name: testpypi -# url: https://test.pypi.org/p/geokube permissions: id-token: write runs-on: ${{ matrix.os }} diff --git a/.github/workflows/main.yml b/.github/workflows/unit_tests.yml similarity index 95% rename from .github/workflows/main.yml rename to .github/workflows/unit_tests.yml index 477eb45..870a56e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/unit_tests.yml @@ -29,7 +29,7 @@ jobs: run: conda activate gk - run: | - conda install -c conda-forge --yes --freeze-installed xesmf cartopy psycopg2 'bokeh>=2.4.2,<3' pandas=1.4.3 netCDF4 scipy xarray=2022.6.0 + conda install -c conda-forge --yes --freeze-installed xesmf - run: | conda run pip install geopandas diff --git a/Dockerfile b/Dockerfile index 92bc214..786fd8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,6 @@ RUN conda clean -afy \ && find /opt/conda/ -follow -type f -name '*.pyc' -delete \ && find /opt/conda/ -follow -type f -name '*.js.map' -delete \ && find /opt/conda/lib/python*/site-packages/bokeh/server/static -follow -type f -name '*.js' ! -name '*.min.js' -delete -COPY dist/geokube-0.2a0-py3-none-any.whl / -RUN pip install /geokube-0.2a0-py3-none-any.whl -RUN rm /geokube-0.2a0-py3-none-any.whl \ No newline at end of file +COPY dist/geokube-0.3.0a0-py3-none-any.whl / +RUN pip install /geokube-0.3.0a0-py3-none-any.whl +RUN rm /geokube-0.3.0a0-py3-none-any.whl \ No newline at end of file diff --git a/README.md b/README.md index a61c95c..186ec84 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Description -geokube is a Python package for analysis of Earth Science Data. +geokube is a Python package based on xarray for GeoScience Data Analysis. ## Authors @@ -14,42 +14,24 @@ geokube is a Python package for analysis of Earth Science Data. ## Installation -#### Requirements -You need to install xesmf and cartopy to use geokube. This can be done during the creation of conda virtual environment, as shown below +You can use pip to install `geokube`. -Add or append conda-forge channel -```bash -conda config --add channels conda-forge -``` -or ```bash -conda config --append channels conda-forge +pip install geokube ``` -#### Conda Environment -Create virtual environment with installing xesmf and cartopy package -```bash -conda create -n geokube python=3.9 xesmf=0.6.2 cartopy -y -``` -Activate virtual environment -```bash -conda activate geokube -``` -Install geokube framework -```bash -python setup.py install -``` +#### Requirements +You need to install `xesmf` if you want to use `geokube` regridding. This can be done during the creation of conda virtual environment, as shown below -#### Conda Package -Create virtual environment with installing conda-build package +Create virtual environment with `xesmf` ```bash -conda create -n geokube python=3.9 conda-build -y +conda create -n geokube python=3.11 xesmf -y ``` Activate virtual environment ```bash conda activate geokube ``` -Execute the script +Install geokube framework ```bash -./conda/build_and_install.sh +pip install geokube ``` \ No newline at end of file diff --git a/docs/about.md b/docs/about.md new file mode 100644 index 0000000..bde524c --- /dev/null +++ b/docs/about.md @@ -0,0 +1,10 @@ +# About + +## Authors +Following authors contributed to the `geokube` framework. + +| Authors | +|--------------------| +| Marco Mancini ORCID logo | +| Mirko Stojiljković ORCID logo | +| Jakub Walczak ORCID logo | diff --git a/docs/axis.md b/docs/axis.md new file mode 100644 index 0000000..8944ee6 --- /dev/null +++ b/docs/axis.md @@ -0,0 +1 @@ +::: geokube.core.axis \ No newline at end of file diff --git a/docs/coord_system.md b/docs/coord_system.md new file mode 100644 index 0000000..e32cb0e --- /dev/null +++ b/docs/coord_system.md @@ -0,0 +1 @@ +::: geokube.core.coord_system \ No newline at end of file diff --git a/docs/crs.md b/docs/crs.md new file mode 100644 index 0000000..0bf8262 --- /dev/null +++ b/docs/crs.md @@ -0,0 +1 @@ +::: geokube.core.crs \ No newline at end of file diff --git a/docs/domain.md b/docs/domain.md new file mode 100644 index 0000000..36b4de2 --- /dev/null +++ b/docs/domain.md @@ -0,0 +1 @@ +::: geokube.core.domain \ No newline at end of file diff --git a/docs/feature.md b/docs/feature.md new file mode 100644 index 0000000..89efca3 --- /dev/null +++ b/docs/feature.md @@ -0,0 +1 @@ +::: geokube.core.feature \ No newline at end of file diff --git a/docs/field.md b/docs/field.md new file mode 100644 index 0000000..60b74e3 --- /dev/null +++ b/docs/field.md @@ -0,0 +1 @@ +::: geokube.core.field \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..41fbba3 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,5 @@ +# Welcome to geokube + +**geokube** is an open source Python package for geoscience data analysis that provides the user with a simple application programming interface (API) for performing geospatial operations (e.g., extracting a bounding box or regridding) and temporal operations (e.g., resampling) on different types of scientific feature types like grids, profiles and points, using on `xarray` data structures like `xarray.Dataset` and custom `xarray.Dataset.indexes` and xarray ecosystem frameworks such as `xesmf` and `cf-xarray`. + +Furthermore, based on xarray IO engines, geokube provides built-in drivers for reading geoscientific datasets produced by Earth Observations (e.g. satellite data) and Earth Systems Models (e.g., weather, climate and oceanographic models) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..ba45bc0 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,48 @@ +site_name: geokube +site_description: geokube - a Python package based on xarray for Geoscience Data Analysis and Visualization +theme: + name: material + palette: + - media: '(prefers-color-scheme: light)' + scheme: default + primary: blue grey + accent: amber + features: + - search.suggest + - search.highlight + - content.tooltips + - content.code.annotate + - content.code.copy + - content.code.select + icon: + repo: fontawesome/brands/github-alt + logo: img/favicon.svg + favicon: img/favicon.svg + language: en +repo_name: CMCC-Foundation/geokube +repo_url: https://github.com/CMCC-Foundation/geokube +edit_uri: '' +use_directory_urls: false + +plugins: +- mkdocstrings: + enabled: !ENV [ENABLE_MKDOCSTRINGS, true] + default_handler: python + handlers: + python: + options: + docstring_style: numpy + +nav: +- geokube: index.md +- API: + - axis.md + - crs.md + - coord_system.md + - feature.md + - domain.md + - field.md +# - Drivers: +# - open_collection.md +- about.md + diff --git a/pyproject.toml b/pyproject.toml index 9ba8460..7872123 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,14 +16,14 @@ build-backend = "flit_core.buildapi" [project] name = "geokube" -version = "0.3a0" +version = "0.3.0a0" authors = [ {name = "geokube Contributors", email = "geokube@googlegroups.com"} ] maintainers = [ {name = "geokube Contributors", email = "geokube@googlegroups.com"} ] -description = "Python package for Earth Science Data Analysis" +description = "a Python package based on xarray for GeoScience Data Analysis" keywords = ["Earth science", "data analysis"] license = {file = "LICENSE"} readme = "README.md" @@ -35,7 +35,7 @@ classifiers = [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering :: Earth Science", + "Topic :: Scientific/Engineering", ] requires-python = ">=3.11" dependencies = [ @@ -49,26 +49,14 @@ dependencies = [ "pyproj>=3.4", "shapely>=2.0", "xarray>=2023.6.0", - "pyarrow>=12.0.1" ] -# dynamic = ["version", "description", "optional-dependencies"] [project.urls] Homepage = "https://github.com/geokube/geokube" -# Documentation = "https://readthedocs.org" -Repository = "https://github.com/opengeokube/geokube.git" +Documentation = "https://geokube.github.io" +Repository = "https://github.com/CMCC-Foundation/geokube.git" # Changelog = "https://github.com/me/spam/blob/master/CHANGELOG.md" [project.optional-dependencies] geo_science = ["gsw>=3.6", "shapely>=2.0"] regridding = ["xesmf"] -#sentinel_data = ["rasterio>=1.3.8.post2", "rioxarray>=0.15"] - -# [project.scripts] -# spam-cli = "spam:main_cli" - -# [project.gui-scripts] -# spam-gui = "spam:main_gui" - -# [project.entry-points."spam.magical"] -# tomatoes = "spam:main_tomatoes" diff --git a/tests/core/test_domain.py b/tests/core/test_domain.py index e63c3de..3d098ef 100644 --- a/tests/core/test_domain.py +++ b/tests/core/test_domain.py @@ -270,17 +270,16 @@ def test_bounding_box_grids(grid, bbox_all, bbox_partial, bbox_noone): def test_nearest_horizontal_grid(grid): grid_ = grid.nearest_horizontal(latitude=41, longitude=-11) -def test_nearest_vertical_points(grid): +def test_nearest_vertical_grid(grid): grid_ = grid.nearest_vertical(10.7) grid_ = grid.nearest_vertical(-100.0) -def test_time_range_profiles(grid): +def test_time_range_grid(grid): pass -def test_latest_points(grid): +def test_latest_grid(grid): pass -def test_to_netcdf_points(grid): -# grid.to_netcdf('data/test_grid.nc') - pass \ No newline at end of file +def test_to_netcdf_grid(grid): + grid.to_netcdf('test_grid.nc') \ No newline at end of file diff --git a/tests/core/test_field.py b/tests/core/test_field.py index c89e7e8..d9dc2b5 100644 --- a/tests/core/test_field.py +++ b/tests/core/test_field.py @@ -24,6 +24,6 @@ def test_create_profiles(f_profiles_no_ancillary): # Field Grid Test # -#def test_create_grid(f_grid_no_ancillary): -# assert f_grid_no_ancillary.dim_axes == (axis.vertical, axis.latitude, axis.longitude) +def test_create_grid(f_grid_no_ancillary): + assert f_grid_no_ancillary.dim_axes == (axis.time, axis.vertical, axis.latitude, axis.longitude) diff --git a/tests/fixtures/features.py b/tests/fixtures/features.py index 285639a..075e277 100644 --- a/tests/fixtures/features.py +++ b/tests/fixtures/features.py @@ -44,7 +44,7 @@ def geodetic_cs(): @pytest.fixture def points1(geodetic_cs): pts = Points( - coords = [('2001-01-01', 10.5, 42.2, -12.2), ('2001-01-02', 11.2, 56.2, 10.2)], + coords = [('2001-01-01', 10.5, 42.2, -12.2), ('2001-01-05', 11.2, 56.2, 10.2)], coord_system = geodetic_cs ) return pts @@ -56,7 +56,7 @@ def points2(geodetic_cs): axis.latitude: [42.2, 56.2], axis.longitude: [-12.2, 10.2], axis.vertical: [10.5, 11.2], - axis.time: ['2001-01-01', '2001-01-02'] + axis.time: ['2001-01-01', '2001-01-05'] }, coord_system = geodetic_cs ) @@ -69,7 +69,7 @@ def profiles(geodetic_cs): axis.latitude: [42.2, 56.2], axis.longitude: [-12.2, 10.2], axis.vertical: [[10.5, 11.2, 12.3], [10.7, 11.5, 12.5, 13.5]], - axis.time: ['2001-01-01', '2001-01-02'] + axis.time: ['2001-01-01', '2001-01-05'] }, coord_system = geodetic_cs ) @@ -82,7 +82,7 @@ def grid(geodetic_cs): axis.latitude: [42.2, 56.2], axis.longitude: [-12.2, 10.2], axis.vertical: [10.5, 11.2, 12.3], - axis.time: ['2001-01-01', '2001-01-02'] + axis.time: ['2001-01-01', '2001-01-05'] }, coord_system = geodetic_cs ) @@ -96,7 +96,7 @@ def grid(geodetic_cs): @pytest.fixture def f_points_no_ancillary(points1): return PointsField( - data = [22.5, 27.5] * units['degree_C'], + data = [22.5, 27.5] * units('degree_C'), domain = points1, name = 'field_points', properties = {'test_property': 'this is a field test property'}, @@ -105,12 +105,12 @@ def f_points_no_ancillary(points1): @pytest.fixture def f_points(points1): return PointsField( - data = [22.5, 27.5] * units['degree_C'], + data = [22.5, 27.5] * units('degree_C'), domain = points1, name = 'field_points', properties = {'test_property': 'this is a field test property'}, ancillary = { - 'anc_1': [0, 1] * units[''] + 'anc_1': [0, 1] * units('') }, ) @@ -139,7 +139,7 @@ def f_profiles(profiles): def f_grid_no_ancillary(grid): a = np.arange(24).reshape(2,3,2,2) return GridField( - data = a * units['degree_C'], + data = a * units('degree_C'), domain = grid, name = 'field_grid', properties = {'test_property': 'this is a field test property'}, @@ -149,11 +149,11 @@ def f_grid_no_ancillary(grid): def f_grid(grid): a = np.arange(24).reshape(2,3,2,2) return GridField( - data = a * units['degree_C'], + data = a * units('degree_C'), domain = grid, name = 'field_grid', properties = {'test_property': 'this is a field test property'}, ancillary = { - 'anc_grid_1': a * units[''] + 'anc_grid_1': a * units('') }, ) \ No newline at end of file