Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add code of conduct #30

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions CODE_OF_CONDUCT.rst
Original file line number Diff line number Diff line change
@@ -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 <mailto: tsutterl@uw.edu>`_.
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 <https://www.contributor-covenant.org/>`_
`Code of Conduct <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>`_ and
the `Geek Feminism <http://geekfeminism.wikia.com>`_
`Community Anti-Harassment Policy <http://geekfeminism.wikia.com/wiki/Community_anti-harassment/Policy>`_.

Community Impact Guidelines were inspired by `Mozilla's code of conduct
enforcement ladder <https://github.com/mozilla/diversity>`_.

We have adapted these documents for our own use under the terms of the
`Creative Commons Attribution License <https://creativecommons.org/licenses/by/4.0/>`_.
35 changes: 11 additions & 24 deletions IS2view/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -51,52 +51,36 @@
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
import matplotlib.colorbar
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'
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 4 additions & 10 deletions IS2view/convert.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -13,31 +13,25 @@
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
Written 07/2022
"""
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')
Expand Down
14 changes: 4 additions & 10 deletions IS2view/io.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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'
Expand Down
14 changes: 4 additions & 10 deletions IS2view/tools.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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'
Expand Down
13 changes: 4 additions & 9 deletions IS2view/utilities.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions doc/source/getting_started/Code-of-Conduct.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../../../CODE_OF_CONDUCT.rst
Loading