Skip to content

Commit

Permalink
Merge 31cd312 into 66e7a54
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoneback committed Apr 26, 2022
2 parents 66e7a54 + 31cd312 commit 8c48ec0
Show file tree
Hide file tree
Showing 17 changed files with 479 additions and 245 deletions.
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Version [e.g. 22]
- Other details about your setup that could be relevant

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
49 changes: 49 additions & 0 deletions .github/pull_request_template.md
@@ -0,0 +1,49 @@
# Description

Addresses #(issue)

Please include a summary of the change and which issue is fixed. Please also
include relevant motivation and context. List any dependencies that are required
for this change. Please see ``CONTRIBUTING.md`` for more guidelines.

## Type of change

Please delete options that are not relevant.

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality
to not work as expected)
- This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details for
your test configuration

- Test A
- Test B

**Test Configuration**:
* Operating system: Hal
* Version number: Python 3.X
* Any details about your local setup that are relevant: pysat version X

# Checklist:

- [ ] Make sure you are merging into the ``develop`` (not ``main``) branch
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] Add a note to ``CHANGELOG.md``, summarizing the changes
- [ ] Update zenodo.json file for new code contributors

If this is a release PR, replace the first item of the above checklist with the
release checklist on the pysat wiki:
https://github.com/pysat/pysat/wiki/Checklist-for-Release
32 changes: 32 additions & 0 deletions .github/workflows/docs.yml
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Documentation Check

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7]

name: Documentation tests
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
pip install -r requirements.txt
- name: Load .zenodo.json to check for errors
run: python -c "import json; json.loads(open('.zenodo.json').read())"
56 changes: 56 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,56 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Pytest with Flake8

on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
os: [ubuntu-latest]
numpy_ver: [latest]
include:
- python-version: "3.8"
numpy_ver: "1.19"
os: "ubuntu-latest"

name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt
pip install -r requirements.txt
- name: Install NEP29 dependencies
if: ${{ matrix.numpy_ver != 'latest'}}
run: |
pip install --no-binary :numpy: numpy==${{ matrix.numpy_ver }}
- name: Test PEP8 compliance
run: flake8 . --count --select=E,F,W --show-source --statistics

- name: Evaluate complexity
run: flake8 . --count --exit-zero --max-complexity=10 --statistics

- name: Install
run: python setup.py develop

- name: Test with pytest
run: pytest --cov=pysatCDF/

- name: Publish results to coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --rcfile=setup.cfg --service=github
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .zenodo.json
@@ -0,0 +1,25 @@
{
"creators": [
{
"affiliation": "Stoneris",
"name": "Stoneback, Russell",
"orcid": "0000-0001-7216-4336"
},
{
"affiliation": "The University of Texas at Dallas",
"name": "Depew, Matthew"
},
{
"affiliation": "Goddard Space Flight Center",
"name": "Klenzing, Jeffrey",
"orcid": "0000-0001-8321-6074"
},
{
"name": "Iyer, Gayatri"
},
{
"affiliation": "Predictive Science",
"name": "Pembroke, Asher"
}
]
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,16 @@
Change Log
==========
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

[0.4.0] - 2022-XX-XX
--------------------
* New Features
* Compatible with pysat v3.0+
* Deprecations
* Documentation
* Bug Fix
* Improved builds for newer compilers.
* Maintenance
* Adopted latest pysat development standards.

62 changes: 18 additions & 44 deletions README.md
@@ -1,6 +1,7 @@
# pysatCDF
[![Build Status](https://travis-ci.org/pysat/pysatCDF.svg?branch=master)](https://travis-ci.org/pysat/pysatCDF)
[![Coverage Status](https://coveralls.io/repos/github/pysat/pysatCDF/badge.svg?branch=master)](https://coveralls.io/github/pysat/pysatCDF?branch=master)
[![PyPI Package latest release](https://img.shields.io/pypi/v/pysatcdf.svg)](https://pypi.python.org/pypi/pysatcdf)
[![Build Status](https://github.com/pysat/pysatCDF/actions/workflows/main.yml/badge.svg)](https://github.com/pysat/pysatCDF/actions/workflows/main.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/pysat/pysatCDF/badge.svg?branch=main)](https://coveralls.io/github/pysat/pysatCDF?branch=main)
[![DOI](https://zenodo.org/badge/51764432.svg)](https://zenodo.org/badge/latestdoi/51764432)

Self-contained Python reader for NASA CDF file format
Expand Down Expand Up @@ -31,10 +32,12 @@ with pysatCDF.CDF(filename) as cdf:
```

# Testing
pysatCDF has been tested on Mac OS X and Ubuntu 15.04. Support is included for building on windows if the mingw environment is present.
pysatCDF has been tested on Mac OS X and Ubuntu 15.04. Support is included
for building on windows via Windows Subsystem for Linux.

# Motivation
Provide simple, robust access to CDF data in Python and simplify adding instruments to [pysat](https://github.com/rstoneback/pysat).
Provide simple, robust access to CDF data in Python and simplify
adding instruments to [pysat](https://github.com/pysat/pysat).

# Installation in POSIX compatible environments
Actual CDF loading is performed by the [NASA CDF libraries] (http://cdf.gsfc.nasa.gov/html/sw_and_docs.html)
Expand All @@ -47,45 +50,16 @@ cd pysatCDF
python setup.py install
```

# Installing pysatCDF in MacOS

MacOS does not ship with a Fortran compiler. One method for getting a suitable
build environment is to use brew.
```
brew install gcc
```

and then install pysatCDF as normal.

# Installing pysatCDF in Windows

Python environment: Python 2.7.x
To compile pysatCDF in Windows, you need a POSIX compatible C/ Fortran compiling environment. Follow the below instructions to achieve this.

1. Install MSYS2 from http://repo.msys2.org. The distrib folder contains msys2-x86_64-latest.exe (64-bit version) to install MSYS2.
2. Assuming you installed it in its default location C:\msys64, launch MSYS2 environment from C:\msys64\msys2.exe. This launches a shell session.
3. Now you need to make sure everything is up to date. This terminal command will run updates
pacman -Syuu
4. After running this command, you will be asked to close the terminal window using close button and not exit() command. Go ahead and do that.
5. Relaunch and run 'pacman -Syuu' again.
6. After the second run, you should be up to date. If you run the update command again, you will be informed that there was nothing more to update. Now you need to install build tools and your compiler toolchains.
pacman -S base-devel git mingw-w64-x86_64-toolchain
If it prompts you to make a selection and says (default:all), just press enter. This install may take a bit.
7. Now you need to set up your MSYS2 environment to use whatever python interpreter you want to build pysatCDF for. In my case the path was C:\Python27_64, but yours will be wherever python.exe exists.
8. Update MSYS2 path to include the folders with python binary and Scripts. To do that, navigate to your home directory in MSYS2. Mine is C:\msys64\home\gayui.
8. Edit the .bash_profile file to add the below lines somewhere in the file.
# Add System python
export PATH=$PATH:/c/Python27_64:/c/Python27_64/Scripts
Note the unix-style paths. So C: becomes /c/. If your python was in C:\foo\bar\python you would put /c/foo/bar/python and /c/foo/bar/python/Scripts
9. Next step is to add the mingw64 bin folder to your windows system path. Right-click on computer, hit properties. Then click advanced system settings, then environment variables. Find the system variable (as opposed to user variables) named PATH. This is a semicolon delimited list of the OS search paths for binaries. Add another semicolon and the path C:\msys64\mingw64\bin
10. Now you should have access to Python from within your MSYS2 environment. And your windows path should have access to the mingw binaries. To verify this, launch the mingw64 MSYS2 environment.
C:\msys64\mingw64.exe
Run the command
which python
and confirm that it points to the correct python version you want to be using.
11. Microsoft Visual C++ 9.0 is required to compile C sources. Download and install the right version of Microsoft Visual C++ for Python 2.7 from -
http://aka.ms/vcpython27
12. We are now getting close to installing pysatCDF. Do the following in the shell environment that is already opened.
mkdir src
cd src
git clone https://github.com/rstoneback/pysatCDF.git
cd pysatCDF
13. Using a text editor of your choice, create a file called setup.cfg in
C:\msys64\home\gayui\src\pysatCDF (note: gayui will be replaced with your username)
Put the following in the file before saving and closing it.
[build]
compiler=mingw32
14. In your MSYS2 MINGW64 environment, run
python setup.py install
This should compile and install the package to your site-packages for the python you are using.
15. You should now be able to import pysatCDF in your Python environment. If you get an ImportError, restart Python and import again.
Install the Windows Subsytem for Linux and proceed as per POSIX installation.
17 changes: 17 additions & 0 deletions pysatCDF/__init__.py
@@ -1 +1,18 @@
"""pysatCDF is a simple reader for NASA's Common Data Format (CDF) files.
pysatCDF uses NASA's C library to do the actual loading and couples
Python to this library via an intermediate Fortran layer.
"""

import os

# Set version
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'version.txt')) as version_file:
__version__ = version_file.read().strip()

# Import CDF interface
from ._cdf import CDF as CDF

del here

0 comments on commit 8c48ec0

Please sign in to comment.