Skip to content

Commit

Permalink
Update whats new with PR #418
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaze committed Dec 12, 2024
1 parent 3a876a6 commit 95ac46e
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 114 deletions.
2 changes: 2 additions & 0 deletions argopy/stores/argo_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class ArgoIndex(indexstore):
>>> idx.read_wmo
>>> idx.read_params
>>> idx.records_per_wmo
>>> idx.copy(deep=False)
"""

Expand Down
53 changes: 39 additions & 14 deletions argopy/stores/argo_index_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,37 +73,44 @@ def __init__(
cachedir: str = "",
timeout: int = 0,
**kwargs,
) -> object:
):
"""Create an Argo index file store
Parameters
----------
host: str, default: ``https://data-argo.ifremer.fr``
Local or remote (ftp, https or s3) path to a `dac` folder (GDAC structure compliant). This takes values
like:
- ``https://data-argo.ifremer.fr``
- ``ftp://ftp.ifremer.fr/ifremer/argo``
- ``s3://argo-gdac-sandbox/pub/idx``
- a local absolute path
Local or remote (ftp, https or s3) path to a `dac` folder (GDAC structure compliant).
This parameter takes values like:
- ``https://data-argo.ifremer.fr``
- ``ftp://ftp.ifremer.fr/ifremer/argo``
- ``s3://argo-gdac-sandbox/pub/idx``
- a local absolute path
You can also use the following keywords: ``http``/``https``, ``ftp`` and ``s3``/``aws``, respectively.
index_file: str, default: ``ar_index_global_prof.txt``
Name of the csv-like text file with the index.
Possible values are standard file name: ``ar_index_global_prof.txt``,
Possible values are the standard file names: ``ar_index_global_prof.txt``,
``argo_bio-profile_index.txt``, ``argo_synthetic-profile_index.txt``
or ``etc/argo-index/argo_aux-profile_index.txt``
or ``etc/argo-index/argo_aux-profile_index.txt``.
You can also use the following keywords: ``core``, ``bgc-b``, ``bgc-s`` and ``aux``.
convention: str, default: None
Set the expected format convention of the index file. This is useful when trying to load index file with custom name. If set to ``None``, we'll try to infer the convention from the ``index_file`` value.
Possible values: ``ar_index_global_prof``, ``argo_bio-profile_index``, ``argo_synthetic-profile_index`` or ``argo_aux-profile_index``.
Set the expected format convention of the index file.
This is useful when trying to load an index file with a custom name.
If set to ``None``, we'll try to infer the convention from the ``index_file`` value.
Possible values: ``ar_index_global_prof``, ``argo_bio-profile_index``, ``argo_synthetic-profile_index``
or ``argo_aux-profile_index``.
You can also use the following keywords: ``core``, ``bgc-s``, ``bgc-b`` and ``aux``.
cache : bool, default: False
Use cache or not.
cachedir: str, default: OPTIONS['cachedir']
Folder where to store cached files
Folder where to store cached files.
timeout: int, default: OPTIONS['api_timeout']
Time out in seconds to connect to a remote host (ftp or http).
"""
Expand Down Expand Up @@ -532,7 +539,7 @@ def _read(self, fs, path, fmt="pq"):
# log.debug("_read this path: '%s'" % this_path)
return obj

def clear_cache(self):
def clear_cache(self) -> Self:
"""Clear cache registry and files associated with this store instance."""
self.fs["src"].clear_cache()
self.fs["client"].clear_cache()
Expand Down Expand Up @@ -1069,5 +1076,23 @@ def copy(
self,
deep: bool = True,
) -> Self:
"""Returns a copy of this object."""
"""Returns a copy of this :class:`ArgoIndex` instance
A copy is a new instance based on similar parameters (e.g. ``host`` and ``index_file``).
A deep copy ensure complete independence between the original and the copied index.
If the index was loaded, a new view is returned with the copied index, but search parameters and results are lost.
A shallow copy preserves the index array, search parameters and results.
Parameters
----------
deep: bool, optional, default=True
Whether the search parameters and results are copied onto the new ArgoIndex instance.
Returns
-------
:class:`ArgoIndex`
"""
return self._copy(deep=deep)
2 changes: 2 additions & 0 deletions docs/api-hidden.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@
argopy.ArgoIndex.search_parameter_data_mode
argopy.ArgoIndex.to_dataframe
argopy.ArgoIndex.to_indexfile
argopy.ArgoIndex.copy


argopy.stores.argo_index_proto_s3.s3index
argopy.stores.argo_index_proto_s3.s3index_core
Expand Down
Loading

0 comments on commit 95ac46e

Please sign in to comment.