Skip to content

Commit

Permalink
Merge branch 'release_0.3' into release_0.3_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Mancini authored Jan 31, 2024
2 parents 5e22ee6 + ad78b14 commit 63250d2
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-push-docker_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-push-docker_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,4 +32,4 @@ jobs:
file: ./Dockerfile
push: true
tags: |
${{ vars.GEOKUBE_REGISTRY }}/geokube:${{ env.TAG }}
${{ vars.GEOKUBE_REGISTRY }}/geokube:${{ env.RELEASE_TAG }}
4 changes: 2 additions & 2 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/testpypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
36 changes: 9 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
```
10 changes: 10 additions & 0 deletions docs/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# About

## Authors
Following authors contributed to the `geokube` framework.

| Authors |
|--------------------|
| Marco Mancini <a href="https://orcid.org/0000-0002-9150-943X"><img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png" width="16" height="16" /></a> |
| Mirko Stojiljković <a href="https://orcid.org/0000-0003-2256-1645"><img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png" width="16" height="16" /></a> |
| Jakub Walczak <a href="https://orcid.org/0000-0002-5632-9484"><img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png" width="16" height="16" /></a> |
1 change: 1 addition & 0 deletions docs/axis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: geokube.core.axis
1 change: 1 addition & 0 deletions docs/coord_system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: geokube.core.coord_system
1 change: 1 addition & 0 deletions docs/crs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: geokube.core.crs
1 change: 1 addition & 0 deletions docs/domain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: geokube.core.domain
1 change: 1 addition & 0 deletions docs/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: geokube.core.feature
1 change: 1 addition & 0 deletions docs/field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: geokube.core.field
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -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)
48 changes: 48 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -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

22 changes: 5 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ build-backend = "flit_core.buildapi"

[project]
name = "geokube"
version = "0.3a0"
version = "0.3.0a0"
authors = [
{name = "geokube Contributors", email = "[email protected]"}
]
maintainers = [
{name = "geokube Contributors", email = "[email protected]"}
]
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"
Expand All @@ -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 = [
Expand All @@ -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"
11 changes: 5 additions & 6 deletions tests/core/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
def test_to_netcdf_grid(grid):
grid.to_netcdf('test_grid.nc')
4 changes: 2 additions & 2 deletions tests/core/test_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

20 changes: 10 additions & 10 deletions tests/fixtures/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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'},
Expand All @@ -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('')
},
)

Expand Down Expand Up @@ -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'},
Expand All @@ -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('')
},
)

0 comments on commit 63250d2

Please sign in to comment.