From 52ad155b02a8fe743544b55a0164c816d433ce91 Mon Sep 17 00:00:00 2001 From: Anton Korosov Date: Tue, 11 Jan 2022 10:52:48 +0100 Subject: [PATCH] create package --- .github/workflows/python-package-conda.yml | 2 +- Dockerfile | 35 ---------------------- README.md | 32 ++++++++++++++++++++ docker-compose.yml | 22 -------------- environment.yml | 19 ++---------- environment_testing.yml | 19 ------------ setup.py | 27 ++++++++--------- 7 files changed, 47 insertions(+), 109 deletions(-) delete mode 100644 Dockerfile delete mode 100644 docker-compose.yml delete mode 100644 environment_testing.yml diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 45ab776..7001adb 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -21,7 +21,7 @@ jobs: id: cache - name: Install dependencies run: | - $CONDA/bin/conda env update --file environment_testing.yml --name base + $CONDA/bin/conda env update --file environment.yml --name base $CONDA/bin/pip install netcdftime pytest gdown if: steps.cache.outputs.cache-hit != 'true' - name: Download test data diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8b0445a..0000000 --- a/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# The build-stage image: -FROM continuumio/miniconda3 AS build - -# Install the package as normal: -COPY environment.yml . -RUN conda env create -f environment.yml - -# Install conda-pack: -RUN conda install -c conda-forge conda-pack - -# Use conda-pack to create a standalone enviornment -# in /venv: -RUN conda-pack -n geodataset -o /tmp/env.tar && \ - mkdir /venv && cd /venv && tar xf /tmp/env.tar && \ - rm /tmp/env.tar - -# We've put venv in same path it'll be in final image, -# so now fix up paths: -RUN /venv/bin/conda-unpack - - -# The runtime-stage image; we can use Debian as the -# base image since the Conda env also includes Python -# for us. -FROM debian:buster AS runtime - -# Copy /venv from the previous stage: -COPY --from=build /venv /venv -ENV TEST_DATA_DIR=/test_data_dir -RUN mkdir /opt/notebooks -COPY geodataset geodataset -# When image is run, run the code with the environment -# activated: -SHELL ["/bin/bash", "-c"] -ENTRYPOINT source /venv/bin/activate && jupyter notebook --allow-root --ip=0.0.0.0 --notebook-dir=/opt/notebooks diff --git a/README.md b/README.md index d72b159..30fe4d6 100644 --- a/README.md +++ b/README.md @@ -1 +1,33 @@ # geodataset + +Extension of netCDF4.Dataset for geospatial data. + +# Installation + +Install requirements with conda: + +`conda env create -f environment.yml` + +Activate the environment: + +`conda activate geodataset` + +Install geodataset using pip: + +`pip install geodataset` + +# Usage + +Open netCDF file for input and access geo- metadata + +```python +from geodataset.tools import open_netcdf + +n = open_netcdf('netcdf_file.nc') + +print(n.projection) + +print(n.get_bbox()) + +print(n.get_lonlat_arrays()) +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 00ef72b..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -version: '3' -services: - jupyter: - build: '.' - volumes: - - './geodataset:/opt/notebooks' - working_dir: '/opt/notebooks' - ports: - - '8888:8888' - - test: - build: '.' - environment: - - TEST_DATA_DIR=${TEST_DATA_DIR} - - PYTHONPATH=/ - entrypoint: /venv/bin/python - command: "/geodataset/run_tests.py" - volumes: - - '${TEST_DATA_DIR}:${TEST_DATA_DIR}' - -... diff --git a/environment.yml b/environment.yml index a8b3fc9..1f0b7a8 100644 --- a/environment.yml +++ b/environment.yml @@ -2,33 +2,18 @@ name: geodataset channels: - conda-forge dependencies: - - gdal - cartopy - - pykdtree - pip + - pykdtree - pip: - cmocean - cython - - ipdb - - ipython - - jupyter - matplotlib - mock - netcdf4 - - nose - - notebook - numpy - - pandas - - paramiko - - pillow - - pygrib - pyproj - - pyshp + - pyresample - pyyaml - - rtree - - scikit-image - - scikit-learn - scipy - - shapely - xarray - - pyresample diff --git a/environment_testing.yml b/environment_testing.yml deleted file mode 100644 index 69fc378..0000000 --- a/environment_testing.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: geodataset_testing -channels: - - conda-forge -dependencies: - - cartopy - - pip - - pykdtree - - pip: - - cmocean - - cython - - matplotlib - - mock - - netcdf4 - - numpy - - pyproj - - pyresample - - pyyaml - - scipy - - xarray diff --git a/setup.py b/setup.py index 5f58f3a..f2a8299 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -import os import setuptools with open("README.md", "r") as fh: @@ -6,10 +5,10 @@ setuptools.setup( name="geodataset", - version="0.0.1", - author="Anton Korosov", + version="0.1.0", + author=["Anton Korosov", "Timothy Williams"], author_email="Anton.Korosov@nersc.no", - description="regridding tool for Geospatial data", + description="Extension of netDCF4.Dataset for geospatial data", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/nansencenter/geodataset", @@ -19,15 +18,13 @@ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: POSIX :: Linux", ], - install_requires=["numpy", - "scipy", - "matplotlib", - "notebook", - "pyproj", - "cython", - "shapely", - "netcdftime", - "cartopy", - "satpy"], - python_requires='>=3.7' + install_requires=[ + "cartopy", + "netCDF4", + "netcdftime", + "numpy", + "pyproj", + "pyresample", + "xarray"], + python_requires='>=3.8' )