| SWEpy

| SWEpy: A Python Library for Quick and Easy Access and Manipulation of MEaSUREs CETB Files for SWE Analysis - Published in JOSS (2018)

https://github.com/wino6687/swepy

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    5 of 8 committers (62.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Engineering Computer Science - 40% confidence
Last synced: 6 months ago · JSON representation

Repository

Python library for scraping, subsetting, and concatenating temperature brightness data for analyzing SWE.

Basic Info
  • Host: GitHub
  • Owner: wino6687
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 164 MB
Statistics
  • Stars: 3
  • Watchers: 0
  • Forks: 2
  • Open Issues: 3
  • Releases: 17
Created almost 8 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

Build Status codecov Documentation Status license OS DOI Code style: black

SWEpy

| Name | Downloads | Version | Platforms | | --- | --- | --- | --- | | Conda Recipe | Conda Downloads | Conda Version PyPI version | Conda Platforms |

Quick Start Guide

For Full Documentation, Please see the Read The Docs!

SWEpy is a Python library designed to simplify access to a passive microwave brightness temperature dataset available at the National Snow and Ice Data Center (NSIDC). This dataset contains Northern and Southern hemisphere imagery along with Equatorial imagery, and can be quite useful in analyzing snow water equivalent (SWE) over large spatial extents. SWEpy contains tools to web scrape, geographically subset, and concatenate files into time cubes. There is an automated workflow to scrape long time series while periodically stopping to geographically subset and concatenate files in order to reduce disk impact.

Setup:

1. Setup Earthdata Login

Create an Earthdata account to be able to download data: https://urs.earthdata.nasa.gov/

2. Setup conda environment from yaml (Recommended)

The libraries used in this analysis, namely pynco, can be finicky with the channels that dependencies are installed with. Thus, using the provided yaml file to build an environment for this project will make your life simpler. You can add more packages on top of the provided environment as long as you install with the conda-forge channel.

Using the yaml file (.yml) create a new conda environment {python} conda env create -f swepy_env.yml

Alternative: Install SWEpy Using Conda or pip:

SWEpy is available from anaconda, and will install all dependencies when installed. It is also available from pip (Pypi), but will not install all the dependencies automatically.

** Important ** conda-forge must be the first channel in your .condarc file.

channels: - conda-forge - defaults

{python} conda install swepy

3. Install ipykernel (if using jupyter and conda environments)

{python} source activate swepy_env python -m ipykernel install --user --name <env name> --display-name "<display name>" Do not include the brackets <>

Using SWEpy for analyzing SWE:

  1. Import SWEpy's data pipeline: {python} import swepy.pipeline as pipeline

  2. Instantiate the class with working directory and bounding coordinates

  3. To scrape data you must also set your Earthdata login and desired date range

    ```{python} upperleft = [lonupleft, latupleft] lowerright = [lonlowright, latlowright]

    start = datetime.date(startY, startM, startD) end = datetime.date(endY, endM, endD)

    path = os.getcwd()

    username = "username" password = "password"

    swe = pipeline.Swepy(path, upperleft, lowerright, highres = True) swe.setlogin(username, password) swe.set_dates(start, end) ```

  4. Don't forget to orient your upper-left and lower-right bounding coordinates with the EASE Grid 2.0 Orientation:

Example Study Area

  • By default, the high_res parameter is set to True, meaning it will scrape high resolution images. If it is passed as 'False' then it will scrape 25km images instead of the 6.25km high resolution images.
  1. Get Files

    a. Use desired functionality, either separate or individually:

    ```{python} swe.scrape() swe.subset() swe.concatenate()

    swe.concatenate(swepy.subset(swepy.scrape())) b. Or, usescrapeallto avoid massive file sizes: {python} swe.scrapeall() ``` This limits the number of full-size images on your disk at one time.

  2. If you need to give the class more information, or change information it already has, use one of the set_ functions: {python} swe.set_grid(ul = [-145,66], lr = [-166, -16])

Using SWEpy's Web Scraper Alone:

  • The web scraper is enabled automatically in the scrape_all workflow, however it can also be used as a standalone function!

```{python} from swepy.nsidcDownloader import nsidcDownloader

Ways to instantiate nsidcDownloader

nD = nsidcDownloader.nsidcDownloader(username="user", password="pass", folder=os.getcwd())

Download a file:

file = { "resolution": "3.125km", "platform": "F17", "sensor": "SSMIS", "date": datetime(2015,10,10), "channel": "37H" }

nD.download_file(**file) ```

Main Dependencies:

  • gdal
  • affine
  • requests
  • scipy
  • pynco
  • netCDF4
  • datetime
  • tqdm
  • pandas

Troubleshooting:

  1. Missing image error when loading in swepy or when calling swepy functions

    • These are channel dependency errors and likely arise due to some of your packages being on conda-forge and others being on other channels. Namely, pynco struggles with this.
    • Make sure conda-forge is at the top of your .condarc file and then run a conda update --all.
    • https://conda-forge.org/docs/conda-forge_gotchas.html#using-multiple-channels
  2. Importing SWEpy fails, or pandas fails to find numpy.

    • This seems to be an issue caused by numpy v1.15.0. I reverted back to 1.14.5 and reinstalled everything and it worked again.

If you experience any other issues, do not hesitate to open an issue in this repo!

Citations:

This library is designed to work with the MEaSUREs CETB dataset:

Brodzik, M. J., D. G. Long, M. A. Hardman, A. Paget, and R. Armstrong. 2016. MEaSUREs Calibrated Enhanced-Resolution Passive Microwave Daily EASE-Grid 2.0 Brightness Temperature ESDR, Version 1. [Indicate subset used]. Boulder, Colorado USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. doi: https://doi.org/10.5067/MEASURES/CRYOSPHERE/NSIDC-0630.001. [June 2018].

Acknowledgements:

I want to thank Davey Lovin and David Nyberg for their help in conceiving the original project and developing the original prototype!

I also want to thank Carson Farmer and Earth Lab, CU Boulder for their support throughout the development of this project.

Owner

  • Name: Will Norris
  • Login: wino6687
  • Kind: user
  • Location: Boulder, Colorado
  • Company: @earthlab

I have a passion for data science, machine learning, and bringing information into the hands of the masses.

JOSS Publication

| SWEpy: A Python Library for Quick and Easy Access and Manipulation of MEaSUREs CETB Files for SWE Analysis
Published
December 06, 2018
Volume 3, Issue 32, Page 1018
Authors
William M. Norris ORCID
Earth Lab, University of Colorado Boulder
Carson J.q. Farmer ORCID
Earth Lab, University of Colorado Boulder
Editor
Arfon Smith ORCID
Tags
snow swe data after_success data processing

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 927
  • Total Committers: 8
  • Avg Commits per committer: 115.875
  • Development Distribution Score (DDS): 0.073
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
wino6687 w****7@c****u 859
davidnyberg d****5@g****m 34
WILLIAM Norris w****s@W****l 19
WILLIAM Norris w****s@c****u 8
1papaya 1****a@g****m 3
WILLIAM Norris w****s@e****u 2
WILLIAM Norris w****s@r****u 1
WILLIAM Norris w****s@e****u 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 8
  • Total pull requests: 3
  • Average time to close issues: about 2 months
  • Average time to close pull requests: less than a minute
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 2.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mbjoseph (4)
  • usethedata (2)
  • wino6687 (2)
Pull Request Authors
  • dependabot[bot] (2)
  • davidnyberg (1)
Top Labels
Issue Labels
bug (2) enhancement (1)
Pull Request Labels
dependencies (2)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 69 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 66
  • Total maintainers: 1
pypi.org: swepy

A python package for obtaining and manipulating Tb files from the MEaSUREs database

  • Versions: 53
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 69 Last month
Rankings
Dependent packages count: 10.0%
Forks count: 16.9%
Average: 19.3%
Dependent repos count: 21.7%
Downloads: 22.7%
Stargazers count: 25.0%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: swepy

SWEpy is a Python library designed to simplify access to a passive microwave brightness temperature dataset available at the National Snow and Ice Data Center (NSIDC). This dataset contains Northern and Southern hemisphere imagery along with Equatorial imagery, and can be quite useful in analyzing snow water equivalent (SWE) over large spatial extents. SWEpy contains tools to web scrape, geographically subset, and concatenate files into time cubes. There is an automated workflow to scrape long time series while periodically stopping to geographically subset and concatenate files in order to reduce disk impact.

  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 53.7%
Average: 55.7%
Stargazers count: 57.7%
Last synced: 6 months ago

Dependencies

docs/environment.yml conda
  • fsspec 0.4.3.*
  • m2r 0.2.1.*
  • matplotlib 3.0.3.*
  • python 3.7.*
  • rtree 0.8.3.*
  • sphinx 1.8.4.*
  • sphinx-gallery 0.2.0.*
  • sphinx_rtd_theme 0.4.3.*
docs/requirements-dev.txt pypi
  • bumpversion ==0.5.3 development
  • codecov ==2.0.15 development
  • fsspec ==0.4.3 development
  • importlib-metadata ==0.19 development
  • m2r ==0.2.1 development
  • numpy ==1.17.5 development
  • pre-commit ==1.17.0 development
  • pytest ==5.0.1 development
  • pytest-cov ==2.7.1 development
  • pytest-vcr ==1.0.2 development
  • sphinx ==2.1.2 development
  • sphinx-autobuild ==0.7.1 development
  • sphinx_gallery ==0.4.0 development
  • sphinx_rtd_theme ==0.4.3 development