Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7f248d8
updated codecov version
caitlyn-wilhelm Dec 29, 2021
de520d8
updated bigplanet
caitlyn-wilhelm Jan 25, 2022
81873c0
updated env yml
caitlyn-wilhelm Jan 26, 2022
4c778a9
updated test yml
caitlyn-wilhelm Jan 26, 2022
53fea79
typo in test yml
caitlyn-wilhelm Jan 26, 2022
202122b
updated test yml
caitlyn-wilhelm Jan 26, 2022
9d21a94
commented out env
caitlyn-wilhelm Jan 26, 2022
2cf8909
fixed env yml
caitlyn-wilhelm Jan 26, 2022
aff9cf7
updated pip command
caitlyn-wilhelm Jan 26, 2022
0a1ea1e
attempt to fix 3.10 install
caitlyn-wilhelm Jan 28, 2022
fb82a22
ran pre-commit
caitlyn-wilhelm Jan 31, 2022
80dc6cc
Edited create_dataset arguments to handle strings in data
rudyg3 Apr 25, 2022
a43b380
Changed vplanet repo to public in test.yml
RoryBarnes Apr 26, 2022
51396bf
Fixed typos in docs.
RoryBarnes Aug 26, 2022
4f04552
Merge branch 'docs' of https://github.com/VirtualPlanetaryLaboratory/…
RoryBarnes Aug 26, 2022
771dc98
Merge branch 'main' of https://github.com/VirtualPlanetaryLaboratory/…
RoryBarnes Mar 15, 2023
48e415a
Update tests.yml
RoryBarnes Mar 15, 2023
8bede88
Update tests.yml
RoryBarnes Mar 15, 2023
c69da90
Update tests.yml
RoryBarnes Mar 15, 2023
be2ebfd
Update README.md
RoryBarnes Mar 15, 2023
9a129ea
Merge pull request #25 from VirtualPlanetaryLaboratory/docs
RoryBarnes Mar 15, 2023
78ba1ce
Update docs.yml
RoryBarnes Mar 15, 2023
4027127
Update README.md
RoryBarnes Mar 15, 2023
9a7efef
Update environment.yml
RoryBarnes Mar 20, 2023
f2a863c
Update environment.yml
RoryBarnes Mar 20, 2023
b1a37f8
Merge branch 'FileWriteFix' of https://github.com/VirtualPlanetaryLab…
RoryBarnes Mar 20, 2023
7a831a3
Fixed issue with md5 checksum. I don't know how this test passed before.
RoryBarnes Mar 20, 2023
09fdfb1
Merge branch 'FileWriteFix' of https://github.com/VirtualPlanetaryLab…
RoryBarnes Mar 21, 2023
6686b82
Fixing ExtractArchive test.
RoryBarnes Mar 21, 2023
dd411d7
Change test bpextractfilterraw to remove old files before performing …
RoryBarnes Mar 21, 2023
056370f
Renamed tests files to match directory names.
Apr 21, 2023
0d9a102
Revamped naming conventions for tests. Tests now delete all old files…
Apr 22, 2023
4c471ae
Added .gitignore to tests directory.
Apr 26, 2023
2c35fd0
Added error handling if vplanet help doesn't work.
RoryBarnes Apr 26, 2023
f1caa7a
Update README.md
RoryBarnes Aug 24, 2023
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
6 changes: 2 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ name: docs

on:
push:
branches: [master, main]
#pull_request: TODO: Enable me
# branches:[master, main]
branches: [main]

jobs:
tests:
name: "Build docs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
id: setup_python
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: tests

on:
push:
branches: [master, main]
branches: [main]
pull_request:
branches: [master, main]
branches: [main]

jobs:
tests:
name: "Run tests on py${{ matrix.python-version }}"
name: 'Run tests on py${{ matrix.python-version }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -18,9 +18,6 @@ jobs:
- python-version: "3.7"
- python-version: "3.8"
- python-version: "3.9"
- python-version: "3.10"
- python-version: "3.11"
- python-version: "3.12"

steps:
- uses: actions/checkout@v2
Expand All @@ -35,7 +32,7 @@ jobs:
environment-file: environment.yml
python-version: ${{ matrix.python-version }}

- name: Install vplanet-private pre-release
- name: Install VPLanet
id: install
if: steps.setup_python.outcome == 'success'
shell: bash -l {0}
Expand All @@ -44,7 +41,6 @@ jobs:
run: |
python -m pip install git+https://[email protected]/VirtualPlanetaryLaboratory/vplanet.git@main#egg=vplanet


- name: Install bigplanet
id: tools
if: steps.install.outcome == 'success'
Expand Down Expand Up @@ -73,7 +69,7 @@ jobs:
comment_mode: update last

- name: CodeCov
uses: codecov/codecov-action@v1.5.0
uses: codecov/codecov-action@v2.1.0
with:
files: ./coverage.xml
#shell: bash -l {0}
Expand Down
24 changes: 1 addition & 23 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,6 @@ SeasonalClimateFiles
*.csv
*.md5

#files created from running tests
tests/Bpstatus/BP_Status/
tests/Bpstatus/.*
tests/CreateHDF5/BP_CreateHDF5/
tests/CreateHDF5/.*
tests/ExtractArchive/BP_Extract/
tests/ExtractArchive/.*
tests/Stats/BP_Stats/
tests/Stats/.*
tests/ExtractFilterArchive/BP_Extract/
tests/ExtractFilterArchive/.*
tests/ExtractFilterRawData/BP_Extract/
tests/ExtractFilterRawData/.*
tests/MD5CheckSum/BP_Extract/
tests/MD5CheckSum/.*
tests/UlyssesAggregated/BP_Extract/
tests/UlyssesAggregated/.*
tests/UlyssesForward/BP_Extract/
tests/UlyssesForward/.*
tests/SingleSim/BP_Extract/
tests/SingleSim/.*


.coverage

# Aux files / build info / garbage
Expand Down Expand Up @@ -89,3 +66,4 @@ junit/test-results.xml
coverage.xml
tests/UlyssesAggregated/User.csv

htmlcov/
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
exclude: 'docs/'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
verbose: true
exclude: '__init__.py'

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: ['--profile', 'black']
verbose: true
exclude: '__init__.py'
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

<p align="center">
<a href="https://VirtualPlanetaryLaboratory.github.io/bigplanet/"><img src="https://img.shields.io/badge/read-the_docs-blue.svg?style=flat"></a>
<img src="https://img.shields.io/badge/Python-3.6--3.10-orange.svg"/></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-purple.svg"/></a>
<a href="https://github.com/VirtualPlanetaryLaboratory/bigplanet/actions/workflows/docs.yml">
<img src="https://github.com/VirtualPlanetaryLaboratory/bigplanet/actions/workflows/docs.yml/badge.svg">
<img src="https://img.shields.io/badge/Python-3.6--3.9-orange.svg"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-purple.svg"></a>
<a href="https://github.com/VirtualPlanetaryLaboratory/bigplanet/actions/workflows/tests.yml">
<img src="https://github.com/VirtualPlanetaryLaboratory/bigplanet/actions/workflows/tests.yml/badge.svg"/>



<img src="https://github.com/VirtualPlanetaryLaboratory/bigplanet/actions/workflows/tests.yml/badge.svg">
<a href="https://github.com/VirtualPlanetaryLaboratory/bigplanet/actions/workflows/wheels.yml">
<img src="https://github.com/VirtualPlanetaryLaboratory/bigplanet/actions/workflows/wheels.yml/badge.svg">
</a>
</p>

A suite of data analysis and extraction routines for [VPLanet](https://github.com/VirtualPlanetaryLaboratory/vplanet) and designed to be used with [VSPACE](https://github.com/VirtualPlanetaryLaboratory/vspace) and [MultiPlanet](https://github.com/VirtualPlanetaryLaboratory/multi-planet) scripts. It can also generate files for use with the free version of the [VR Ulysses data explorer](https://www.vrulysses.com/download-ulysses). [Read the docs](https://VirtualPlanetaryLaboratory.github.io/bigplanet/) to learn how to get the most out of your VPLanet parameter sweeps.
A suite of data analysis and extraction routines for [VPLanet](https://github.com/VirtualPlanetaryLaboratory/vplanet) and designed to be used with [VSPACE](https://github.com/VirtualPlanetaryLaboratory/vspace) and [MultiPlanet](https://github.com/VirtualPlanetaryLaboratory/multi-planet) scripts. It can also generate files for use with the free version of the [VR Ulysses data explorer](https://www.vrulysses.com/download-ulysses). [Read the docs](https://VirtualPlanetaryLaboratory.github.io/bigplanet/) to learn how to get the most out of your `VPLanet` parameter sweeps.
115 changes: 87 additions & 28 deletions bigplanet/bigplanet.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
#!/usr/bin/env python

import os
import argparse
import multiprocessing as mp
import os
import subprocess as sub
import argparse

import h5py
import numpy as np
import pandas as pd

from .bigplanet_archive import Archive
from .bigplanet_filter import Filter
from .bp_get import ReadFile
from .bp_extract import Md5CheckSum
from .bp_get import ReadFile


def Main(bpInputFile, cores, quiet, overwrite, verbose, archive, deleterawdata, ignorecorrupt):
def Main(
bpInputFile,
cores,
quiet,
overwrite,
verbose,
archive,
deleterawdata,
ignorecorrupt,
):
# folder,bplArchive,output,bodyFileList,primaryFile,IncludeList,ExcludeList,Ulysses = ReadFile(file,verbose)
#
# if if IncludeList != [] and ExcludeList != [] and os.path.isfile(bplArchive) == False:
Expand All @@ -23,14 +34,26 @@ def Main(bpInputFile, cores, quiet, overwrite, verbose, archive, deleterawdata,
# print("Creating filtered BPF file...")
# MainMethodF(bpInputFile,quiet,verbose)
if deleterawdata == True:
#folder_name, bpl_file, outputFile, bodylist, primaryFile, includelist, excludelist, Ulysses, SimName
folder, bplArchive, output, bodyFileList, primaryFile, IncludeList, ExcludeList, Ulysses, simname = ReadFile(
bpInputFile, verbose, archive)
# folder_name, bpl_file, outputFile, bodylist, primaryFile, includelist, excludelist, Ulysses, SimName
(
folder,
bplArchive,
output,
bodyFileList,
primaryFile,
IncludeList,
ExcludeList,
Ulysses,
simname,
) = ReadFile(bpInputFile, verbose, archive)
if os.path.exists(bplArchive) == True:
Md5CheckSum(bplArchive, ignorecorrupt)
reply = None
question = ("WARNING: This command will delete the " +
folder + " directory along with any MultiPlanet checkpoint files.")
question = (
"WARNING: This command will delete the "
+ folder
+ " directory along with any MultiPlanet checkpoint files."
)
while reply not in ("y", "n"):
reply = str(input(question + " (y/n): ")).lower().strip()
if reply[:1] == "y":
Expand All @@ -42,7 +65,7 @@ def Main(bpInputFile, cores, quiet, overwrite, verbose, archive, deleterawdata,
if reply[:1] == "n":
print("Files NOT deleted. Exiting.")
exit()
if reply[:1] != "n" or reply[:1] != "y":
else:
print("User input was not valid. Exiting.")
exit()

Expand All @@ -60,27 +83,63 @@ def Main(bpInputFile, cores, quiet, overwrite, verbose, archive, deleterawdata,
def Arguments():
max_cores = mp.cpu_count()
parser = argparse.ArgumentParser(
description="Extract data from Vplanet simulations")
description="Extract data from Vplanet simulations"
)
parser.add_argument(
"bpInputFile", help="Name of the biugplanet input file"
)
parser.add_argument(
"-c",
"--cores",
type=int,
default=max_cores,
help="Number of processors used",
)
parser.add_argument(
"-o",
"--overwrite",
action="store_true",
help="overwrite file if it already exists",
)
parser.add_argument(
"-a",
"--archive",
action="store_true",
help="flag for archive file creation",
)
parser.add_argument(
"-deleterawdata",
"--deleterawdata",
action="store_true",
help="removes source files after creation of Bigplanet files",
)
parser.add_argument(
"bpInputFile", help="Name of the biugplanet input file")
parser.add_argument("-c", "--cores", type=int,
default=max_cores, help="Number of processors used")
parser.add_argument("-o", "--overwrite", action="store_true",
help="overwrite file if it already exists")
parser.add_argument("-a", "--archive", action="store_true",
help="flag for archive file creation")
parser.add_argument("-deleterawdata", "--deleterawdata", action="store_true",
help="removes source files after creation of Bigplanet files")
parser.add_argument("-ignorecorrupt", "--ignorecorrupt", action="store_true",
help="ignore data corruption for MD5 Checksum")
"-ignorecorrupt",
"--ignorecorrupt",
action="store_true",
help="ignore data corruption for MD5 Checksum",
)
# adds the quiet and verbose as mutually exclusive groups
group = parser.add_mutually_exclusive_group()
group.add_argument("-q", "--quiet", action="store_true",
help="no output for bigplanet")
group.add_argument("-v", "--verbose", action="store_true",
help="Prints out excess output for bigplanet")
group.add_argument(
"-q", "--quiet", action="store_true", help="no output for bigplanet"
)
group.add_argument(
"-v",
"--verbose",
action="store_true",
help="Prints out excess output for bigplanet",
)

args = parser.parse_args()

Main(args.bpInputFile, args.cores, args.quiet,
args.overwrite, args.verbose, args.archive, args.deleterawdata, args.ignorecorrupt)
Main(
args.bpInputFile,
args.cores,
args.quiet,
args.overwrite,
args.verbose,
args.archive,
args.deleterawdata,
args.ignorecorrupt,
)
Loading