Skip to content

Commit b8bdb49

Browse files
authored
feat: use attempt login for nsidc utilities (#55)
* feat: add NASA CMR spatial bounding box queries * feat: update classify photons parameters to match current GSFC version * feat: updates for uploading to pypi * refactor: place some imports behind try/except statements
1 parent 21f434b commit b8bdb49

17 files changed

Lines changed: 302 additions & 273 deletions

.github/workflows/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ RUN pip3 install --no-cache-dir --no-binary=h5py,cartopy \
300300
paramiko \
301301
pyproj \
302302
python-dateutil \
303+
pyYAPC \
303304
scikit-learn \
304305
scipy \
305306
scp \

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ read-ICESat-2
44

55
|Language|
66
|License|
7+
|PyPI Version|
78
|Documentation Status|
89
|Binder|
910
|Pangeo|
@@ -15,6 +16,9 @@ read-ICESat-2
1516
.. |License| image:: https://img.shields.io/badge/license-MIT-green.svg
1617
:target: https://github.com/tsutterley/read-ICESat-2/blob/main/LICENSE
1718

19+
.. |PyPI Version| image:: https://img.shields.io/pypi/v/icesat2-toolkit.svg
20+
:target: https://pypi.python.org/pypi/icesat2-toolkit/
21+
1822
.. |Documentation Status| image:: https://readthedocs.org/projects/read-icesat-2/badge/?version=latest
1923
:target: https://read-icesat-2.readthedocs.io/en/latest/?badge=latest
2024

doc/source/getting_started/Install.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ The ``read-ICESat-2`` installation uses the ``gdal-config`` routines to set the
2727
Installation
2828
############
2929

30-
Presently ``read-ICESat-2`` is only available for use as a
31-
`GitHub repository <https://github.com/tsutterley/read-ICESat-2>`_.
30+
``read-ICESat-2`` is available for download from the `GitHub repository <https://github.com/tsutterley/read-ICESat-2>`_,
31+
and the `Python Package Index (pypi) <https://pypi.org/project/icesat2-toolkit/>`_,
3232
The contents of the repository can be download as a
3333
`zipped file <https://github.com/tsutterley/read-ICESat-2/archive/main.zip>`_ or cloned.
3434
To use this repository, please fork into your own account and then clone onto your system.
@@ -55,6 +55,11 @@ Alternatively can install the utilities directly from GitHub with ``pip``:
5555
5656
python3 -m pip install --user git+https://github.com/tsutterley/read-ICESat-2.git
5757
58-
Executable versions of this repository can also be tested using
59-
`Binder <https://mybinder.org/v2/gh/tsutterley/read-ICESat-2/main>`_ or
60-
`Pangeo <https://aws-uswest2-binder.pangeo.io/v2/gh/tsutterley/read-ICESat-2/main?urlpath=lab>`_.
58+
| This repository can be also tested using `BinderHub <https://github.com/jupyterhub/binderhub>`_ platforms:
59+
| |Binder| |Pangeo|
60+
61+
.. |Binder| image:: https://mybinder.org/badge_logo.svg
62+
:target: https://mybinder.org/v2/gh/tsutterley/read-ICESat-2/main
63+
64+
.. |Pangeo| image:: https://img.shields.io/static/v1.svg?logo=Jupyter&label=PangeoBinderAWS&message=us-west-2&color=orange
65+
:target: https://aws-uswest2-binder.pangeo.io/v2/gh/tsutterley/read-ICESat-2/main?urlpath=lab

doc/source/getting_started/Parallel-HDF5.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,27 @@ Dependencies
4141

4242
.. code-block:: bash
4343
44-
curl -O http://zlib.net/zlib-1.2.11.tar.gz
44+
curl -O http://zlib.net/zlib-1.2.12.tar.gz
4545
export CFLAGS=-fPIC
46-
mkdir -p $HOME/packages/zlib/1.2.11
47-
./configure --prefix=$HOME/packages/zlib/1.2.11
46+
mkdir -p $HOME/packages/zlib/1.2.12
47+
./configure --prefix=$HOME/packages/zlib/1.2.12
4848
make
4949
make install
5050
51-
modulefile for local installation of zlib (``~/privatemodules/zlib/1.2.11``):
51+
modulefile for local installation of zlib (``~/privatemodules/zlib/1.2.12``):
5252

5353
.. code-block:: tcl
5454
5555
#%Module 1.0
5656
#
5757
# zlib module for use with 'environment-modules' package:
5858
#
59-
module-whatis "Provides zlib 1.2.11 (local)"
59+
module-whatis "Provides zlib 1.2.12 (local)"
6060
global env
61-
prepend-path PATH $env(HOME)/packages/zlib/1.2.11/bin
62-
prepend-path LD_LIBRARY_PATH $env(HOME)/packages/zlib/1.2.11/lib
63-
prepend-path MANPATH $env(HOME)/packages/zlib/1.2.11/share/man/
64-
append-path ZLIB_DIR $env(HOME)/packages/zlib/1.2.11/
61+
prepend-path PATH $env(HOME)/packages/zlib/1.2.12/bin
62+
prepend-path LD_LIBRARY_PATH $env(HOME)/packages/zlib/1.2.12/lib
63+
prepend-path MANPATH $env(HOME)/packages/zlib/1.2.12/share/man/
64+
append-path ZLIB_DIR $env(HOME)/packages/zlib/1.2.12/
6565
6666
6767
- `szip <https://support.hdfgroup.org/doc_resource/SZIP/>`_
@@ -127,7 +127,7 @@ modulefile for local installation of OpenMPI (``~/privatemodules/mpi/openmpi/4.0
127127
CC=~/packages/mpi/openmpi/4.0.3/bin/mpicc ./configure \
128128
--enable-parallel --enable-hl --enable-shared \
129129
--prefix=$HOME/packages/hdf5/1.10.5 \
130-
--with-zlib=$HOME/packages/zlib/1.2.11 \
130+
--with-zlib=$HOME/packages/zlib/1.2.12 \
131131
--with-szip=$HOME/packages/szip/2.1.1
132132
make
133133
make check
@@ -143,7 +143,7 @@ modulefile for local installation of HDF5 (``~/privatemodules/hdf5/1.10.5``):
143143
#
144144
module-whatis "Provides hdf5 1.10.5 (local)"
145145
global env
146-
prereq $env(HOME)/privatemodules/zlib/1.2.11 $env(HOME)/privatemodules/szip/2.1.1 $env(HOME)/privatemodules/mpi/openmpi/4.0.3
146+
prereq $env(HOME)/privatemodules/zlib/1.2.12 $env(HOME)/privatemodules/szip/2.1.1 $env(HOME)/privatemodules/mpi/openmpi/4.0.3
147147
prepend-path PATH $env(HOME)/packages/hdf5/1.10.5/bin
148148
prepend-path LD_LIBRARY_PATH $env(HOME)/packages/hdf5/1.10.5/lib
149149
prepend-path MANPATH $env(HOME)/packages/hdf5/1.10.5/share/man/

environment.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
name: read-ICESat-2
1+
name: icesat2_toolkit
22
channels:
33
- conda-forge
44
dependencies:
55
- python>=3.6
66
- notebook
7-
- numpy
8-
- scipy
9-
- scikit-learn
10-
- python-dateutil
11-
- pandas
12-
- pyproj
13-
- matplotlib
7+
- boto3
148
- cartopy
15-
- mpi4py
9+
- future
1610
- gdal
1711
- h5py>=2.9=mpi*
18-
- netCDF4
19-
- zarr
20-
- future
21-
- boto3
2212
- lxml
13+
- matplotlib
14+
- mpi4py
15+
- netCDF4
16+
- numpy
17+
- pandas
2318
- paramiko
19+
- pyproj
20+
- python-dateutil
21+
- scikit-learn
22+
- scipy
2423
- scp
24+
- zarr
2525
- pip:
2626
- git+https://github.com/tsutterley/yapc.git

icesat2_toolkit/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import icesat2_toolkit.time
2020
import icesat2_toolkit.utilities
2121
import icesat2_toolkit.version
22-
from icesat2_toolkit.convert import convert
2322
from icesat2_toolkit.convert_delta_time import convert_delta_time
2423
from icesat2_toolkit.read_ICESat2_ATL03 import read_HDF5_ATL03, \
2524
find_HDF5_ATL03_beams, read_HDF5_ATL09, read_HDF5_ATL03_main, read_HDF5_ATL03_beam
@@ -33,4 +32,4 @@
3332
from icesat2_toolkit.read_ICESat2_ATL12 import read_HDF5_ATL12, \
3433
find_HDF5_ATL12_beams
3534
# get version number
36-
__version__ = icesat2_toolkit.version.version
35+
__version__ = icesat2_toolkit.version.version

icesat2_toolkit/convert.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
convert.py
3-
Written by Tyler Sutterley (04/2022)
3+
Written by Tyler Sutterley (06/2022)
44
Utilities for converting ICESat-2 HDF5 files into different formats
55
66
PYTHON DEPENDENCIES:
@@ -21,6 +21,7 @@
2121
time.py: Utilities for calculating time operations
2222
2323
UPDATE HISTORY:
24+
Updated 06/2022: place zarr and pandas imports behind try/except statements
2425
Updated 04/2022: updated docstrings to numpy documentation format
2526
Updated 01/2022: added ascii and dataframe outputs for ATL07
2627
Updated 09/2021: added ground track and time to output dataframes
@@ -33,13 +34,26 @@
3334
import os
3435
import re
3536
import h5py
36-
import zarr
37-
import pandas
37+
import warnings
3838
import itertools
3939
import posixpath
4040
import numpy as np
4141
from icesat2_toolkit.convert_delta_time import convert_delta_time
4242

43+
try:
44+
import pandas
45+
except ModuleNotFoundError:
46+
warnings.filterwarnings("always")
47+
warnings.warn("pandas not available")
48+
warnings.warn("Some functions will throw an exception if called")
49+
50+
try:
51+
import zarr
52+
except ModuleNotFoundError:
53+
warnings.filterwarnings("always")
54+
warnings.warn("zarr not available")
55+
warnings.warn("Some functions will throw an exception if called")
56+
4357
class convert():
4458
np.seterr(invalid='ignore')
4559
def __init__(self, filename=None, reformat=None):

icesat2_toolkit/spatial.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
u"""
33
spatial.py
4-
Written by Tyler Sutterley (04/2022)
4+
Written by Tyler Sutterley (06/2022)
55
66
Utilities for reading and operating on spatial data
77
@@ -17,6 +17,7 @@
1717
https://pypi.python.org/pypi/GDAL
1818
1919
UPDATE HISTORY:
20+
Updated 06/2022: place netCDF4 import behind try/except statements
2021
Updated 04/2022: updated docstrings to numpy documentation format
2122
Updated 01/2022: use iteration breaks in convert ellipsoid function
2223
Written 11/2021
@@ -28,14 +29,22 @@
2829
import uuid
2930
import h5py
3031
import logging
31-
import netCDF4
3232
import warnings
3333
import numpy as np
34+
35+
try:
36+
import netCDF4
37+
except ModuleNotFoundError:
38+
warnings.filterwarnings("always")
39+
warnings.warn("netCDF4 not available")
40+
warnings.warn("Some functions will throw an exception if called")
41+
3442
try:
3543
import osgeo.gdal, osgeo.osr, osgeo.gdalconst
3644
except ModuleNotFoundError:
3745
warnings.filterwarnings("always")
3846
warnings.warn("GDAL not available")
47+
warnings.warn("Some functions will throw an exception if called")
3948

4049
def case_insensitive_filename(filename):
4150
"""

0 commit comments

Comments
 (0)