-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from OceanParcels/code_cleanup_and_standardisa…
…tion Code cleanup and standardisation
- Loading branch information
Showing
48 changed files
with
1,989 additions
and
22,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[flake8] | ||
ignore = | ||
# missing whitespace around arithmetic operator | ||
E226, | ||
# do not use bare except, specify exception instead | ||
E722, | ||
# line break before binary operator | ||
W503, | ||
# line too long (82 > 79 characters) | ||
E501, | ||
# ‘from module import *’ used; unable to detect undefined names | ||
F403, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Setup Conda and install plasticparcels | ||
description: > | ||
In-repo composite action to setup Conda and install parcels. Installation of parcels relies on | ||
`setup.py` file being available in the root. For general setup of Anaconda environments, just use | ||
the `mamba-org/setup-micromamba@v1` action (setting C variables as required), or the `conda-incubator/setup-miniconda` action. | ||
inputs: | ||
environment-file: | ||
description: Conda environment file to use. | ||
default: environment.yml | ||
environment-name: | ||
description: Name to use for the Conda environment | ||
default: test | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install micromamba (${{ inputs.environment-file }}) | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: ${{ inputs.environment-file }} | ||
environment-name: ${{ inputs.environment-name }} | ||
channels: conda-forge | ||
cache-environment: true | ||
cache-downloads: true | ||
- name: Install parcels | ||
run: pip install . | ||
shell: bash -el {0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: linting | ||
on: | ||
pull_request: | ||
push: | ||
jobs: | ||
linting: | ||
name: Linting with flake8 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Python setup | ||
run: | | ||
pip install wheel | ||
pip install flake8 | ||
- name: flake8 | ||
run: | | ||
python -m flake8 plasticparcels | ||
python -m flake8 tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: unit-tests | ||
on: | ||
pull_request: | ||
push: | ||
schedule: | ||
- cron: "0 7 * * 1" # Run every Monday at 7:00 UTC | ||
|
||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
|
||
jobs: | ||
unit-test: | ||
name: Unittesting on ubuntu with python latest | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Conda and parcels | ||
uses: ./.github/actions/install-plasticparcels | ||
with: | ||
environment-file: environment.yml | ||
environment-name: py3_parcels | ||
- name: Unit test | ||
run: | | ||
python -m pytest -v -s tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
data/ | ||
fig/ | ||
input_data/ | ||
**.code-workspace* | ||
**.DS_store** | ||
**.pyc** | ||
**.nc | ||
**.zarr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
{ | ||
"use_3D": true, | ||
"allow_time_extrapolation": false, | ||
"verbose_delete": false, | ||
"use_mixing": false, | ||
"use_biofouling": false, | ||
"use_stokes": false, | ||
"use_wind": false, | ||
"ocean": { | ||
"modelname": "NEMO0083", | ||
"directory": "/storage/shared/oceanparcels/input_data/MOi/", | ||
"filename_style": "psy4v3r1/psy4v3r1-daily_", | ||
"ocean_mesh": "domain_ORCA0083-N006/PSY4V3R1_mesh_hgr.nc", | ||
"bathymetry_mesh": "domain_ORCA0083-N006/PSY4V3R1_mesh_zgr.nc", | ||
"variables": { | ||
"U": "vozocrtx", | ||
"V": "vomecrty", | ||
"W": "vovecrtz", | ||
"conservative_temperature": "votemper", | ||
"absolute_salinity": "vosaline" | ||
}, | ||
"dimensions": { | ||
"U": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
}, | ||
"V": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
}, | ||
"W": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
}, | ||
"conservative_temperature": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
}, | ||
"absolute_salinity": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
} | ||
}, | ||
"indices": {}, | ||
"bathymetry_variables": { | ||
"bathymetry": "mbathy" | ||
}, | ||
"bathymetry_dimensions": { | ||
"lon": "nav_lon", | ||
"lat": "nav_lat" | ||
}, | ||
"mixing_variables": { | ||
"mixing_kz": "votkeavt" | ||
}, | ||
"mixing_dimensions": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
} | ||
}, | ||
"bgc": { | ||
"directory": "/storage/shared/oceanparcels/input_data/MOi/", | ||
"filename_style": "biomer4v2r1/biomer4v2r1-weekly_", | ||
"bgc_mesh": "domain_ORCA025-N006/mesh_hgr_PSY4V3_deg.nc", | ||
"variables": { | ||
"pp_phyto": "nppv", | ||
"bio_nanophy": "phy", | ||
"bio_diatom": "phy2" | ||
}, | ||
"dimensions": { | ||
"pp_phyto": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
}, | ||
"bio_nanophy": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
}, | ||
"bio_diatom": { | ||
"lon": "glamf", | ||
"lat": "gphif", | ||
"depth": "depthw", | ||
"time": "time_counter" | ||
} | ||
}, | ||
"indices": {}, | ||
"constants": { | ||
"biofilm_density": 1388.0, | ||
"algae_cell_volume": 2e-16, | ||
"K": 1.3805834190672156e-23, | ||
"R20": 1.1574074074074074e-06, | ||
"Q10": 2.13, | ||
"Gamma": 2.0, | ||
"carbon_molecular_weight": 12.0, | ||
"collision_probability": 1.0, | ||
"algae_mortality_rate": 1.0, | ||
"algae_respiration_f": 1.0 | ||
} | ||
}, | ||
"stokes": { | ||
"directory": "/storage/shared/oceanparcels/output_data/data_Michael/ERA5/waves/", | ||
"filename_style": "ERA5_global_waves_monthly_", | ||
"variables": { | ||
"Stokes_U": "ust", | ||
"Stokes_V": "vst", | ||
"wave_Tp": "pp1d" | ||
}, | ||
"dimensions": { | ||
"lat": "latitude", | ||
"lon": "longitude", | ||
"time": "time" | ||
}, | ||
"indices": {} | ||
}, | ||
"wind": { | ||
"directory": "/storage/shared/oceanparcels/output_data/data_Michael/ERA5/wind/", | ||
"filename_style": "ERA5_global_wind_monthly_", | ||
"variables": { | ||
"Wind_U": "u10", | ||
"Wind_V": "v10" | ||
}, | ||
"dimensions": { | ||
"lat": "latitude", | ||
"lon": "longitude", | ||
"time": "time" | ||
}, | ||
"indices": {} | ||
}, | ||
"unbeaching": { | ||
"directory": "input_data/NEMO0083/", | ||
"filename": "land_current_NEMO0083.nc", | ||
"variables": { | ||
"unbeach_U": "land_current_u", | ||
"unbeach_V": "land_current_v" | ||
}, | ||
"dimensions": { | ||
"lat": "lat", | ||
"lon": "lon" | ||
} | ||
}, | ||
"simulation": { | ||
"start_date": null, | ||
"runtime": null, | ||
"dt_write": null, | ||
"dt_timestep": null | ||
}, | ||
"release_maps": { | ||
"coastal": "input_data/NEMO0083/coastal_population_MPW_NEMO0083.csv", | ||
"rivers": "input_data/NEMO0083/river_emissions_NEMO0083.csv", | ||
"fisheries": "input_data/NEMO0083/agg_data_fisheries_info.csv", | ||
"global_concentrations": null | ||
} | ||
} |
Oops, something went wrong.