Skip to content

Commit 23d4e5a

Browse files
authored
Merge pull request #13 from OceanParcels/code_cleanup_and_standardisation
Code cleanup and standardisation
2 parents d748b97 + 903d479 commit 23d4e5a

48 files changed

Lines changed: 1989 additions & 22735 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[flake8]
2+
ignore =
3+
# missing whitespace around arithmetic operator
4+
E226,
5+
# do not use bare except, specify exception instead
6+
E722,
7+
# line break before binary operator
8+
W503,
9+
# line too long (82 > 79 characters)
10+
E501,
11+
# ‘from module import *’ used; unable to detect undefined names
12+
F403,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Setup Conda and install plasticparcels
2+
description: >
3+
In-repo composite action to setup Conda and install parcels. Installation of parcels relies on
4+
`setup.py` file being available in the root. For general setup of Anaconda environments, just use
5+
the `mamba-org/setup-micromamba@v1` action (setting C variables as required), or the `conda-incubator/setup-miniconda` action.
6+
inputs:
7+
environment-file:
8+
description: Conda environment file to use.
9+
default: environment.yml
10+
environment-name:
11+
description: Name to use for the Conda environment
12+
default: test
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Install micromamba (${{ inputs.environment-file }})
17+
uses: mamba-org/setup-micromamba@v1
18+
with:
19+
environment-file: ${{ inputs.environment-file }}
20+
environment-name: ${{ inputs.environment-name }}
21+
channels: conda-forge
22+
cache-environment: true
23+
cache-downloads: true
24+
- name: Install parcels
25+
run: pip install .
26+
shell: bash -el {0}

.github/workflows/draft-pdf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
with:
1313
journal: joss
1414
# This should be the path to the paper within your repo.
15-
paper-path: paper/paper.md
15+
paper-path: docs/paper/paper.md
1616
- name: Upload
1717
uses: actions/upload-artifact@v1
1818
with:
1919
name: paper
2020
# This is the output path where Pandoc will write the compiled
2121
# PDF. Note, this should be the same directory as the input
2222
# paper.md
23-
path: paper/paper.pdf
23+
path: docs/paper/paper.pdf

.github/workflows/linting.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: linting
2+
on:
3+
pull_request:
4+
push:
5+
jobs:
6+
linting:
7+
name: Linting with flake8
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@master
12+
- name: Python setup
13+
run: |
14+
pip install wheel
15+
pip install flake8
16+
- name: flake8
17+
run: |
18+
python -m flake8 plasticparcels
19+
python -m flake8 tests

.github/workflows/unit_tests.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: unit-tests
2+
on:
3+
pull_request:
4+
push:
5+
schedule:
6+
- cron: "0 7 * * 1" # Run every Monday at 7:00 UTC
7+
8+
defaults:
9+
run:
10+
shell: bash -el {0}
11+
12+
jobs:
13+
unit-test:
14+
name: Unittesting on ubuntu with python latest
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
- name: Setup Conda and parcels
22+
uses: ./.github/actions/install-plasticparcels
23+
with:
24+
environment-file: environment.yml
25+
environment-name: py3_parcels
26+
- name: Unit test
27+
run: |
28+
python -m pytest -v -s tests

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
data/
2-
fig/
1+
input_data/
32
**.code-workspace*
43
**.DS_store**
54
**.pyc**
5+
**.nc
6+
**.zarr

README.md

Lines changed: 34 additions & 31 deletions
Large diffs are not rendered by default.
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
{
2+
"use_3D": true,
3+
"allow_time_extrapolation": false,
4+
"verbose_delete": false,
5+
"use_mixing": false,
6+
"use_biofouling": false,
7+
"use_stokes": false,
8+
"use_wind": false,
9+
"ocean": {
10+
"modelname": "NEMO0083",
11+
"directory": "/storage/shared/oceanparcels/input_data/MOi/",
12+
"filename_style": "psy4v3r1/psy4v3r1-daily_",
13+
"ocean_mesh": "domain_ORCA0083-N006/PSY4V3R1_mesh_hgr.nc",
14+
"bathymetry_mesh": "domain_ORCA0083-N006/PSY4V3R1_mesh_zgr.nc",
15+
"variables": {
16+
"U": "vozocrtx",
17+
"V": "vomecrty",
18+
"W": "vovecrtz",
19+
"conservative_temperature": "votemper",
20+
"absolute_salinity": "vosaline"
21+
},
22+
"dimensions": {
23+
"U": {
24+
"lon": "glamf",
25+
"lat": "gphif",
26+
"depth": "depthw",
27+
"time": "time_counter"
28+
},
29+
"V": {
30+
"lon": "glamf",
31+
"lat": "gphif",
32+
"depth": "depthw",
33+
"time": "time_counter"
34+
},
35+
"W": {
36+
"lon": "glamf",
37+
"lat": "gphif",
38+
"depth": "depthw",
39+
"time": "time_counter"
40+
},
41+
"conservative_temperature": {
42+
"lon": "glamf",
43+
"lat": "gphif",
44+
"depth": "depthw",
45+
"time": "time_counter"
46+
},
47+
"absolute_salinity": {
48+
"lon": "glamf",
49+
"lat": "gphif",
50+
"depth": "depthw",
51+
"time": "time_counter"
52+
}
53+
},
54+
"indices": {},
55+
"bathymetry_variables": {
56+
"bathymetry": "mbathy"
57+
},
58+
"bathymetry_dimensions": {
59+
"lon": "nav_lon",
60+
"lat": "nav_lat"
61+
},
62+
"mixing_variables": {
63+
"mixing_kz": "votkeavt"
64+
},
65+
"mixing_dimensions": {
66+
"lon": "glamf",
67+
"lat": "gphif",
68+
"depth": "depthw",
69+
"time": "time_counter"
70+
}
71+
},
72+
"bgc": {
73+
"directory": "/storage/shared/oceanparcels/input_data/MOi/",
74+
"filename_style": "biomer4v2r1/biomer4v2r1-weekly_",
75+
"bgc_mesh": "domain_ORCA025-N006/mesh_hgr_PSY4V3_deg.nc",
76+
"variables": {
77+
"pp_phyto": "nppv",
78+
"bio_nanophy": "phy",
79+
"bio_diatom": "phy2"
80+
},
81+
"dimensions": {
82+
"pp_phyto": {
83+
"lon": "glamf",
84+
"lat": "gphif",
85+
"depth": "depthw",
86+
"time": "time_counter"
87+
},
88+
"bio_nanophy": {
89+
"lon": "glamf",
90+
"lat": "gphif",
91+
"depth": "depthw",
92+
"time": "time_counter"
93+
},
94+
"bio_diatom": {
95+
"lon": "glamf",
96+
"lat": "gphif",
97+
"depth": "depthw",
98+
"time": "time_counter"
99+
}
100+
},
101+
"indices": {},
102+
"constants": {
103+
"biofilm_density": 1388.0,
104+
"algae_cell_volume": 2e-16,
105+
"K": 1.3805834190672156e-23,
106+
"R20": 1.1574074074074074e-06,
107+
"Q10": 2.13,
108+
"Gamma": 2.0,
109+
"carbon_molecular_weight": 12.0,
110+
"collision_probability": 1.0,
111+
"algae_mortality_rate": 1.0,
112+
"algae_respiration_f": 1.0
113+
}
114+
},
115+
"stokes": {
116+
"directory": "/storage/shared/oceanparcels/output_data/data_Michael/ERA5/waves/",
117+
"filename_style": "ERA5_global_waves_monthly_",
118+
"variables": {
119+
"Stokes_U": "ust",
120+
"Stokes_V": "vst",
121+
"wave_Tp": "pp1d"
122+
},
123+
"dimensions": {
124+
"lat": "latitude",
125+
"lon": "longitude",
126+
"time": "time"
127+
},
128+
"indices": {}
129+
},
130+
"wind": {
131+
"directory": "/storage/shared/oceanparcels/output_data/data_Michael/ERA5/wind/",
132+
"filename_style": "ERA5_global_wind_monthly_",
133+
"variables": {
134+
"Wind_U": "u10",
135+
"Wind_V": "v10"
136+
},
137+
"dimensions": {
138+
"lat": "latitude",
139+
"lon": "longitude",
140+
"time": "time"
141+
},
142+
"indices": {}
143+
},
144+
"unbeaching": {
145+
"directory": "input_data/NEMO0083/",
146+
"filename": "land_current_NEMO0083.nc",
147+
"variables": {
148+
"unbeach_U": "land_current_u",
149+
"unbeach_V": "land_current_v"
150+
},
151+
"dimensions": {
152+
"lat": "lat",
153+
"lon": "lon"
154+
}
155+
},
156+
"simulation": {
157+
"start_date": null,
158+
"runtime": null,
159+
"dt_write": null,
160+
"dt_timestep": null
161+
},
162+
"release_maps": {
163+
"coastal": "input_data/NEMO0083/coastal_population_MPW_NEMO0083.csv",
164+
"rivers": "input_data/NEMO0083/river_emissions_NEMO0083.csv",
165+
"fisheries": "input_data/NEMO0083/agg_data_fisheries_info.csv",
166+
"global_concentrations": null
167+
}
168+
}

0 commit comments

Comments
 (0)