Skip to content

Commit

Permalink
Merge pull request #25 from euroargodev/release-v0.3.1
Browse files Browse the repository at this point in the history
Prepare for v0.3.1
  • Loading branch information
gmaze authored Nov 22, 2023
2 parents c518305 + f8e451e commit 6c8f0cc
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sphinx-rtd-theme
sphinx-book-theme
# sphinx-bootstrap-theme

parcels<2.3.0
parcels==2.4.2
cgen
pymbolic
Pydap
Expand Down
6 changes: 3 additions & 3 deletions docs/usage/preparation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ Once you created a :class:`FloatConfiguration` instance, you can modify one or m
cfg.update('parking_depth', 500)
If you want the same mission configuration for all your virtual floats, you can pass this configuration when instanciate a :class:`VirtualFleet` :
If you want the same mission configuration for all your virtual floats, you can pass this configuration when instantiating a :class:`VirtualFleet` :

.. code:: python
VFleet = VirtualFleet(plan=my_plan, fieldset=VELfield.fieldset, mission=cfg.mission)
VFleet = VirtualFleet(plan=my_plan, fieldset=VELfield, mission=cfg)
But you can also customized the mission of each float by passing an array of mission configurations to the :class:`VirtualFleet` instance :

Expand All @@ -166,4 +166,4 @@ But you can also customized the mission of each float by passing an array of mis
FloatConfiguration('default').update('parking_depth', 1000),
FloatConfiguration('default').update('parking_depth', 1500)
]
VFleet = VirtualFleet(plan=my_plan, fieldset=VELfield.fieldset, mission=mission)
VFleet = VirtualFleet(plan=my_plan, fieldset=VELfield, mission=mission)
33 changes: 33 additions & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,39 @@ What's New

|pypi dwn|


v0.3.1 (22 Nov. 2023)
---------------------

.. note:: This is the last version compatible with Parcels versions < 3.0.0

**New features**

- Mission parameters can now be set for each floats of the deployment plan. This is useful to limit the number of simulations to explore a set of configuration parameters. (:pr:`22`) by `K. Balem <http://www.github.com/quai20>`_.
For instance:

.. code-block:: python
# Number of floats
nfloats = 5
# Define space/time locations of deployments:
lat = np.linspace(40, 41, nfloats)
lon = np.full_like(lat, 5)
tim = np.array(['2020-01-16' for i in range(nfloats)], dtype='datetime64')
my_plan = {'lat': lat, 'lon': lon, 'time': tim}
mission = [
FloatConfiguration('default').update('parking_depth', 100),
FloatConfiguration('default').update('parking_depth', 200),
FloatConfiguration('default').update('parking_depth', 500),
FloatConfiguration('default').update('parking_depth', 1000),
FloatConfiguration('default').update('parking_depth', 1500)
]
VFleet = VirtualFleet(plan=my_plan, fieldset=VELfield, mission=mission)
v0.3.0 (25 Jan. 2023)
---------------------
By `G. Maze <http://www.github.com/gmaze>`_ and `K. Balem <http://www.github.com/quai20>`_.
Expand Down
2 changes: 1 addition & 1 deletion environment-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- python=3.8
- xarray
- parcels>=2.4.0
- parcels<3.0.0
- scipy
- netcdf4
- dask
Expand Down
2 changes: 1 addition & 1 deletion virtualargofleet/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def meta_to_json(d):
class FloatConfiguration:
"""Float mission configuration manager
Create a default configuration and then possibly update parameter values or add new ones
Create a default configuration and then possibly update parameter values
Can be used to create a virtual fleet, to save or load float configurations
Expand Down
14 changes: 9 additions & 5 deletions virtualargofleet/virtualargofleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .utilities import simu2csv, simu2index, strfdelta, getSystemInfo
from packaging import version
import time
from typing import Union
from typing import Union, Iterable


log = logging.getLogger("virtualfleet.virtualfleet")
Expand All @@ -38,8 +38,8 @@ class VirtualFleet:
def __init__(self,
plan: dict,
fieldset: Union[FieldSet, VelocityField],
mission: Union[dict, FloatConfiguration, list, np.ndarray, tuple],
isglobal: bool=False,
mission: Union[dict, FloatConfiguration, Iterable[dict], Iterable[FloatConfiguration]],
isglobal: bool = False,
**kwargs):
"""Create an Argo Virtual Fleet simulator
Expand All @@ -51,8 +51,12 @@ def __init__(self,
Depth is optional, if not provided it will be set to 1m.
fieldset: :class:`parcels.fieldset.FieldSet` or :class:`VelocityField`
A velocity field
mission: dict or :class:`FloatConfiguration` or list/array of those (then it should be the same length as plan arrays)
A dictionary with at least the following Argo float mission parameters: ``parking_depth``, ``profile_depth``, ``vertical_speed`` and ``cycle_duration``
mission: dict or :class:`FloatConfiguration` or an iterable of those
A dictionary with the following Argo float mission parameters: ``parking_depth``, ``profile_depth``,
``vertical_speed`` and ``cycle_duration``. A :class:`FloatConfiguration` instance can also be passed.
An iterable of dictionaries or :class:`FloatConfiguration` can be passed to specified mission parameters for each
virtual floats. In this case, the length of the iterable must match the length of the deployment plan.
isglobal: bool, optional, default=False
A boolean indicating weather the velocity field is global or not
Expand Down

0 comments on commit 6c8f0cc

Please sign in to comment.