From 6d743cfb6f4e111937a0f25453fe68e7447d2326 Mon Sep 17 00:00:00 2001 From: Tyler Sutterley Date: Wed, 12 Jul 2023 22:05:42 -0700 Subject: [PATCH] docs: add code of conduct (#30) fix: drop more dependencies from environnment chore: update version.txt --- CODE_OF_CONDUCT.rst | 136 ++++++++++++++++++ IS2view/api.py | 35 ++--- IS2view/convert.py | 14 +- IS2view/io.py | 14 +- IS2view/tools.py | 14 +- IS2view/utilities.py | 13 +- .../getting_started/Code-of-Conduct.rst | 1 + doc/source/getting_started/Contributing.rst | 3 +- doc/source/index.rst | 1 + environment.yml | 4 - version.txt | 2 +- 11 files changed, 168 insertions(+), 69 deletions(-) create mode 100644 CODE_OF_CONDUCT.rst create mode 100644 doc/source/getting_started/Code-of-Conduct.rst diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst new file mode 100644 index 0000000..7806e98 --- /dev/null +++ b/CODE_OF_CONDUCT.rst @@ -0,0 +1,136 @@ +=============== +Code of Conduct +=============== + +Our Pledge +########## + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +Our Standards +############# + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* Offensive comments related to gender, gender identity and expression, sexual orientation, + disability, mental illness, physical appearance, body size, race, or religion +* Deliberate misgendering or use of "dead" or rejected names +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Incitement or threats of violence towards any individual, + including encouraging a person to commit suicide or to engage in self-harm +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Advocating for, or encouraging, any of the above behavior +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +Enforcement Responsibilities +############################ + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +Enforcement +########### + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +`@tsutterley `_. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +Enforcement Guidelines +###################### + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +1. Correction +------------- + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +2. Warning +---------- + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +3. Temporary Ban +---------------- + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +4. Permanent Ban +---------------- + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +Attribution +########### + +This code of conduct is adapted from the `Contributor Covenant `_ +`Code of Conduct `_ and +the `Geek Feminism `_ +`Community Anti-Harassment Policy `_. + +Community Impact Guidelines were inspired by `Mozilla's code of conduct +enforcement ladder `_. + +We have adapted these documents for our own use under the terms of the +`Creative Commons Attribution License `_. diff --git a/IS2view/api.py b/IS2view/api.py index 41497a3..f7ce878 100644 --- a/IS2view/api.py +++ b/IS2view/api.py @@ -29,6 +29,7 @@ Updated 07/2023: renamed module from IS2view.py to api.py add plot functions for map basemaps and added geometries add imshow function for visualizing current leaflet map + use logging instead of warnings for import attempts Updated 06/2023: moved widgets functions to separate moddule Updated 12/2022: added case for warping input image Updated 11/2022: modifications for dask-chunked rasters @@ -41,7 +42,6 @@ import base64 import asyncio import logging -import warnings import numpy as np import collections.abc from traitlets import HasTraits, Float, Tuple, observe @@ -51,21 +51,15 @@ try: import geopandas as gpd except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("geopandas not available") - warnings.warn("Some functions will throw an exception if called") + logging.debug("geopandas not available") try: import ipywidgets except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("ipywidgets not available") - warnings.warn("Some functions will throw an exception if called") + logging.debug("ipywidgets not available") try: import ipyleaflet except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("ipyleaflet not available") - warnings.warn("Some functions will throw an exception if called") + logging.debug("ipyleaflet not available") try: import matplotlib import matplotlib.cm as cm @@ -73,30 +67,20 @@ import matplotlib.pyplot as plt import matplotlib.colors as colors except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("matplotlib not available") - warnings.warn("Some functions will throw an exception if called") + logging.critical("matplotlib not available") try: import owslib.wms except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("owslib not available") - warnings.warn("Some functions will throw an exception if called") + logging.debug("owslib not available") try: import rasterio.transform import rasterio.warp except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("rasterio not available") - warnings.warn("Some functions will throw an exception if called") + logging.critical("rasterio not available") try: import xarray as xr except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("xarray not available") - warnings.warn("Some functions will throw an exception if called") -# ignore warnings -warnings.filterwarnings("ignore") + logging.critical("xarray not available") # set environmental variable for anonymous s3 access os.environ['AWS_NO_SIGN_REQUEST'] = 'YES' @@ -454,6 +438,9 @@ def plot_basemap(self, ax=None, **kwargs): kwargs.setdefault('bbox', bbox) # create WMS request for basemap image at bounds and resolution srs = kwargs['srs'].replace(':', '').lower() + # url of NASA Global Imagery Browse Services (GIBS) + # https://wiki.earthdata.nasa.gov/display/GIBS + # https://worldview.earthdata.nasa.gov/ url = f'https://gibs.earthdata.nasa.gov/wms/{srs}/best/wms.cgi?' wms = owslib.wms.WebMapService(url=url, version='1.1.1') basemap = wms.getmap(**kwargs) diff --git a/IS2view/convert.py b/IS2view/convert.py index bee48be..ebf182c 100644 --- a/IS2view/convert.py +++ b/IS2view/convert.py @@ -1,6 +1,6 @@ """ convert.py -Written by Tyler Sutterley (06/2023) +Written by Tyler Sutterley (07/2023) Utilities for converting gridded ICESat-2 files from native netCDF4 PYTHON DEPENDENCIES: @@ -13,6 +13,7 @@ https://docs.xarray.dev/en/stable/ UPDATE HISTORY: + Updated 07/2023: use logging instead of warnings for import attempts Updated 06/2023: using pathlib to define and expand paths Updated 11/2022: output variables and attributes in top-level group use netCDF4 directly due to changes in xarray backends @@ -20,24 +21,17 @@ """ import logging import pathlib -import warnings import numpy as np # attempt imports try: import netCDF4 except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("netCDF4 not available") - warnings.warn("Some functions will throw an exception if called") + logging.critical("netCDF4 not available") try: import xarray as xr except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("xarray not available") - warnings.warn("Some functions will throw an exception if called") -# ignore warnings -warnings.filterwarnings("ignore") + logging.critical("xarray not available") class convert(): np.seterr(invalid='ignore') diff --git a/IS2view/io.py b/IS2view/io.py index 4b8dc2d..01e5ebc 100644 --- a/IS2view/io.py +++ b/IS2view/io.py @@ -1,6 +1,6 @@ """ io.py -Written by Tyler Sutterley (11/2022) +Written by Tyler Sutterley (07/2023) Utilities for reading gridded ICESat-2 files using rasterio and xarray PYTHON DEPENDENCIES: @@ -18,28 +18,22 @@ https://docs.xarray.dev/en/stable/ UPDATE HISTORY: + Updated 07/2023: use logging instead of warnings for import attempts Written 11/2022 """ import os import logging -import warnings import numpy as np # attempt imports try: import rioxarray except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("rioxarray not available") - warnings.warn("Some functions will throw an exception if called") + logging.critical("rioxarray not available") try: import xarray as xr except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("xarray not available") - warnings.warn("Some functions will throw an exception if called") -# ignore warnings -warnings.filterwarnings("ignore") + logging.critical("xarray not available") # set environmental variable for anonymous s3 access os.environ['AWS_NO_SIGN_REQUEST'] = 'YES' diff --git a/IS2view/tools.py b/IS2view/tools.py index ff85ee3..a7b02b4 100644 --- a/IS2view/tools.py +++ b/IS2view/tools.py @@ -1,7 +1,7 @@ #!/usr/bin/env python u""" tools.py -Written by Tyler Sutterley (12/2022) +Written by Tyler Sutterley (07/2023) User interface tools for Jupyter Notebooks PYTHON DEPENDENCIES: @@ -15,6 +15,7 @@ https://github.com/matplotlib/matplotlib UPDATE HISTORY: + Updated 07/2023: use logging instead of warnings for import attempts Updated 06/2023: moved widgets functions to separate module Updated 12/2022: added case for warping input image Updated 11/2022: modifications for dask-chunked rasters @@ -23,24 +24,17 @@ import os import copy import logging -import warnings import numpy as np # attempt imports try: import ipywidgets except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("ipywidgets not available") - warnings.warn("Some functions will throw an exception if called") + logging.debug("ipywidgets not available") try: import matplotlib.cm as cm except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("matplotlib not available") - warnings.warn("Some functions will throw an exception if called") -# ignore warnings -warnings.filterwarnings("ignore") + logging.debug("matplotlib not available") # set environmental variable for anonymous s3 access os.environ['AWS_NO_SIGN_REQUEST'] = 'YES' diff --git a/IS2view/utilities.py b/IS2view/utilities.py index 508b931..d29b451 100644 --- a/IS2view/utilities.py +++ b/IS2view/utilities.py @@ -1,10 +1,11 @@ #!/usr/bin/env python u""" utilities.py -Written by Tyler Sutterley (06/2023) +Written by Tyler Sutterley (07/2023) Download and management utilities UPDATE HISTORY: + Updated 07/2023: use logging instead of warnings for import attempts Updated 06/2023: using pathlib to define and expand paths add functions to retrieve and revoke NASA Earthdata User tokens updated netCDF4 request type for NSIDC s3 bucket CMR queries @@ -47,17 +48,11 @@ try: import boto3 except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("boto3 not available") - warnings.warn("Some functions will throw an exception if called") + logging.debug("boto3 not available") try: import s3fs except (ImportError, ModuleNotFoundError) as exc: - warnings.filterwarnings("module") - warnings.warn("s3fs not available") - warnings.warn("Some functions will throw an exception if called") -# ignore warnings -warnings.filterwarnings("ignore") + logging.debug("s3fs not available") # PURPOSE: get absolute path within a package from a relative path def get_data_path(relpath: list | str | pathlib.Path): diff --git a/doc/source/getting_started/Code-of-Conduct.rst b/doc/source/getting_started/Code-of-Conduct.rst new file mode 100644 index 0000000..89ef3ba --- /dev/null +++ b/doc/source/getting_started/Code-of-Conduct.rst @@ -0,0 +1 @@ +.. include:: ../../../CODE_OF_CONDUCT.rst \ No newline at end of file diff --git a/doc/source/getting_started/Contributing.rst b/doc/source/getting_started/Contributing.rst index 2106101..847ad27 100644 --- a/doc/source/getting_started/Contributing.rst +++ b/doc/source/getting_started/Contributing.rst @@ -4,6 +4,7 @@ Contribution Guidelines We welcome and invite contributions from anyone at any career stage and with any amount of coding experience towards the development of ``IS2view``. We appreciate any and all contributions made to the project. +Please read our `code of conduct <./Code-of-Conduct.html>`_ before contributing to ``IS2view`` development. You will be recognized for your work by being listed as one of the `project contributors <./Citations.html#contributors>`_. Ways to Contribute @@ -51,7 +52,7 @@ Steps to Contribute 2) Either by cloning to your local system or working in `GitHub Codespaces `_, create a work environment to make your changes. 3) Add your fork as the ``origin`` remote and the original project repository as the ``upstream`` remote. While this step isn't a necessary, it allows you to keep your fork up to date in the future. 4) Create a new branch to do your work. -5) Make your changes on the new branch and add yourself to the list of `project contributors <./Citations.html#contributors>`_. +5) Make your changes on the new branch and add yourself to the list of project `contributors `_. 6) Push your work to GitHub under your fork of the project. 7) Submit a `Pull Request `_ from your forked branch to the project repository. diff --git a/doc/source/index.rst b/doc/source/index.rst index 2dd173a..df1ec73 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -12,6 +12,7 @@ Interactive visualization and data extraction tool for ICESat-2 ATL14/15 Gridded getting_started/NASA-Earthdata.rst getting_started/Data-Products.rst getting_started/Contributing.rst + getting_started/Code-of-Conduct.rst getting_started/Resources.rst getting_started/Citations.rst diff --git a/environment.yml b/environment.yml index 32a15ca..6dfe796 100644 --- a/environment.yml +++ b/environment.yml @@ -2,9 +2,6 @@ name: IS2view channels: - conda-forge dependencies: - - boto3 - - bottleneck - - dask - ipyleaflet - ipywidgets - matplotlib @@ -14,6 +11,5 @@ dependencies: - python>=3.6 - numpy>=1.21 - rioxarray - - s3fs - setuptools_scm - xarray diff --git a/version.txt b/version.txt index bcab45a..81340c7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.3 +0.0.4