Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ Manager for particle tracking simulations.
<p><small>Project based on the <a target="_blank" href="https://github.com/jbusecke/cookiecutter-science-project">cookiecutter science project template</a>.</small></p>


# Installation

Install with

pip install particle-tracking-manager

or

conda install -c conda-forge particle-tracking-manager

To install environment from github repo after cloning repo:

conda env create -f environment.yml

To install packages to run pre-commit:

mamba install --file requirements-dev.txt
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
# Examples (remove and add as needed)
- adios_db
- aiohttp
- fastparquet
- jupyter
- jupyterlab
- xarray
Expand Down
13 changes: 13 additions & 0 deletions particle_tracking_manager/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def is_datestr(s):
return False


def is_deltastr(s):
"""Check if string is actually a Timedelta."""

try:
out = pd.Timedelta(s)
assert not pd.isnull(out)
return True
except (ValueError, AssertionError):
return False


# https://sumit-ghosh.com/articles/parsing-dictionary-key-value-pairs-kwargs-argparse-python/
class ParseKwargs(argparse.Action):
"""With can user can input dicts on CLI."""
Expand All @@ -70,6 +81,8 @@ def __call__(self, parser, namespace, values, option_string=None):
value = None
elif is_datestr(value):
value = pd.Timestamp(value)
elif is_deltastr(value):
value = pd.Timedelta(value)
getattr(namespace, self.dest)[key] = value


Expand Down
6 changes: 6 additions & 0 deletions particle_tracking_manager/the_manager_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@
"ptm_level": 1,
"description": "Name of ocean model to use for driving drifter simulation, by default None. Use None for testing and set up. Otherwise input a string. Options are \"NWGOA\", \"CIOFS\", \"CIOFS_now\". Alternatively keep as None and set up a separate reader (see example in docs)."
},
"ocean_model_local": {
"type": "bool",
"default": false,
"ptm_level": 3,
"description": "Set to True to use local version of known `ocean_model` instead of remote version."
},
"surface_only": {
"type": "bool",
"default": "None",
Expand Down