Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory prefix Argo GDAC file system #424

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from
Draft

Conversation

gmaze
Copy link
Member

@gmaze gmaze commented Dec 19, 2024

In this PR we provide a file system with a directory prefix for any Argo GDAC compliant path.

The goal is to be able to simply create a gdacfs instance with a GDAC path (local or remote) that won't require the GDAC path to be systematically provided to open files.

In other word, before this PR we have to do this:

from argopy.stores import gdacfs
fs = gdacfs("https://data-argo.ifremer.fr")
ds = fs.open_dataset("https://data-argo.ifremer.fr/dac/coriolis/6903091/profiles/R6903091_001.nc")
# or
fs = gdacfs("https://usgodae.org/pub/outgoing/argo")
ds = fs.open_dataset("https://usgodae.org/pub/outgoing/argo/dac/coriolis/6903091/profiles/R6903091_001.nc")

and after the PR we will be able to do this:

from argopy.stores import gdacfs
fs = gdacfs("https://data-argo.ifremer.fr")
# or
fs = gdacfs("https://usgodae.org/pub/outgoing/argo")
# then
ds = fs.open_dataset("dac/coriolis/6903091/profiles/R6903091_001.nc")

This is easily implemented in the current gdacfs but requires a lot of upstream compatibility check for all argopy stores implementations.

The ultimate test will be this to run ok:

from argopy.stores import gdacfs
from argopy.utils import list_gdac_servers

for gdac_path in list_gdac_servers():
  fs = gdacfs(gdac_path)
  ds =  fs.open_dataset("dac/coriolis/6903091/profiles/R6903091_001.nc")

gmaze added 30 commits September 3, 2024 14:35
commit 62ba4cb
Merge: 919484e ce6fed9
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 13:50:16 2024 +0200

    Merge pull request #389 from euroargodev/other-major-breaking-refactoring

    Implement other than bgc-2024 branch major breaking refactoring for major release v1.0.0

commit ce6fed9
Merge: fa05fa7 919484e
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 12:08:02 2024 +0200

    Merge branch 'master' into other-major-breaking-refactoring

commit fa05fa7
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 12:07:02 2024 +0200

    Delete test_deprecated.py

commit 919484e
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 11:37:21 2024 +0200

    Fix ci tests env

    fix error    libmamba Could not solve for environment specs
          The following packages are incompatible
          ├─ fsspec 2024.9.0*  is requested and can be installed;
          └─ s3fs 2024.6.1*  is not installable because it requires
             └─ fsspec 2024.6.1 , which conflicts with any installable versions previously reported.
      critical libmamba Could not solve for environment specs

commit 0dc9834
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 11:31:21 2024 +0200

    Add upstream tests with python 3.11 and 3.12

commit a1aedc5
Merge: 747ba13 549d8c3
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 11:25:09 2024 +0200

    Merge branch 'master' into other-major-breaking-refactoring

commit 549d8c3
Merge: 1e79ec0 2d4785d
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 11:20:42 2024 +0200

    Merge pull request #356 from euroargodev/bgc-2024

    Work on BGC from 2024 LOV visit

commit 2d4785d
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 10:30:17 2024 +0200

    Remove 45mins timeout for CI tests

commit 1797037
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 08:03:22 2024 +0200

    Update CI tests data

    include standard and research mode for erddap BGC

commit 82c20c8
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 07:44:50 2024 +0200

    Update CI tests data

commit f7ebc21
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 25 07:39:34 2024 +0200

    Update test_deprecated.py

commit 51355c3
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Tue Sep 24 12:08:05 2024 +0200

    update CI tests data

commit 809adc9
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Tue Sep 24 10:37:20 2024 +0200

    Update create_json_assets

commit 2ff193f
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Tue Sep 24 10:37:15 2024 +0200

    Update argovis_data.py

    make sure argovis is only using a single filestore

commit a73f727
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Tue Sep 24 10:36:53 2024 +0200

    Update CI tests data

commit cf41ba4
Merge: 4681d55 1e79ec0
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Mon Sep 23 14:59:03 2024 +0200

    Merge branch 'master' into bgc-2024

commit 4681d55
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Mon Sep 23 14:57:32 2024 +0200

    Clear CI tests for easier merge with master [skip-ci]

commit 1e79ec0
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Mon Sep 23 14:56:59 2024 +0200

    Clear CI tests data for easier merge [skip-ci]

commit c9de8b9
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Mon Sep 23 14:54:43 2024 +0200

    Clear CI tests data before merge

commit a21a644
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Mon Sep 23 09:56:26 2024 +0200

    Update whats-new.rst

commit fe8b91c
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 15:38:26 2024 +0200

    Update requirements.txt

commit 4ae5aab
Merge: 0f5a754 b135bfa
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 15:36:58 2024 +0200

    Merge pull request #394 from euroargodev/releasev0.1.17

    Prepare for v0.1.17 Bat Release 🦇

commit b135bfa
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 14:16:32 2024 +0200

    Update dev env definitions

commit 0f5a754
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 13:54:21 2024 +0200

    Update HOW_TO_RELEASE.md [skip-ci]

commit 4bc625e
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 13:49:08 2024 +0200

    Flake8

commit 34d1a46
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 13:45:15 2024 +0200

    codespell

commit 6259011
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 13:42:32 2024 +0200

    Fix CI tests data update

commit c5ab622
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 13:36:15 2024 +0200

    Update cheatsheet.rst

commit cb66217
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 13:28:25 2024 +0200

    Update cheatsheet PDF

commit 10ff2cf
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 11:50:15 2024 +0200

    Update CI tests data

commit ec0b14c
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 11:48:41 2024 +0200

    Update HOW_TO_RELEASE.md [skip-ci]

commit e2df789
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 11:28:55 2024 +0200

    Update static assets

commit cffefc0
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 11:28:24 2024 +0200

    Update reference_tables.py

commit 6cf2644
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 11:07:15 2024 +0200

    Update whats-new.rst

commit eb7e689
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 11:07:12 2024 +0200

    Update fetchers.py

commit d8121d8
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 10:58:12 2024 +0200

    Update HOW_TO_RELEASE.md [skip-ci]

commit 88ff363
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 10:34:20 2024 +0200

    Move to v0.1.17, to Beta

commit e48ab55
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 09:47:51 2024 +0200

    Update xarray.py

    don't anticipate too much on the upcoming filter_data_mode replacement

commit 29a5cfc
Merge: 5a31057 f3b0a56
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 09:45:45 2024 +0200

    Merge pull request #388 from euroargodev/deprec-before-major

    Introduces deprecation warnings before major v1.0.0 release

commit f3b0a56
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 20 08:56:53 2024 +0200

    Better deprecation introduction

commit 5a31057
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Thu Sep 19 14:15:02 2024 +0200

    Pin erddapy for python < 3.10

    See ioos/erddapy#359

commit 747ba13
Merge: 37f2495 0095fe6
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 18 15:33:08 2024 +0200

    Merge branch 'master' into other-major-breaking-refactoring

commit 37f2495
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 18 15:32:46 2024 +0200

    Update monitored_threadpool.py

commit 6d9be49
Merge: 62ece42 0095fe6
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 18 15:30:38 2024 +0200

    Merge branch 'master' into bgc-2024

commit 2669301
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 13 14:46:38 2024 +0200

    [skip-ci]

commit e87afe1
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 13 14:32:06 2024 +0200

    Create test_deprecated.py

    Ensure we're having warnings for deprecations

commit c319d0a
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 13 14:31:32 2024 +0200

    Update xarray.py

    fix deprecation warning

commit 19daad3
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 13 14:31:13 2024 +0200

    New deprecation for option 'ftp' replaced by 'gdac'

commit c890602
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Fri Sep 13 14:30:32 2024 +0200

    introduce new "OptionDeprecatedWarning"

commit 850adf1
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 4 11:14:10 2024 +0200

    Deprec for 'dataset' option replaced by 'ds'

commit 1371625
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 4 10:12:43 2024 +0200

    Update whats-new.rst

commit a988d79
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 4 10:10:43 2024 +0200

    Update xarray.py

commit acc789e
Author: Guillaume Maze <gmaze@ifremer.fr>
Date:   Wed Sep 4 10:08:07 2024 +0200

    Update xarray.py
@gmaze gmaze added the enhancement New feature or request label Dec 19, 2024
Copy link

codecov bot commented Dec 19, 2024

❌ 178 Tests Failed:

Tests completed Failed Passed Skipped
1729 178 1551 546
View the top 3 failed tests by shortest run time
test_fetchers_index_gdac.py::TestBackend::test_fetching[file, float]
Stack Traces | 0.001s run time
No failure message available
test_fetchers_index_gdac.py::TestBackend::test_fetching[file, profile]
Stack Traces | 0.001s run time
No failure message available
test_plot_plot.py::Test_bar_plot::test_with_a_region[with_seaborn=False, by=institution]
Stack Traces | 0.001s run time
self = <argopy.tests.test_plot_plot.Test_bar_plot object at 0x000001DA1E4E9D10>
opts = (False, 'institution')

    @pytest.mark.parametrize("opts", opts, indirect=False, ids=opts_ids)
    def test_with_a_region(self, opts):
>       with argopy.set_options(src=self.src, gdac=self.local_gdac):

argopy\tests\test_plot_plot.py:151: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
argopy\options.py:264: in __init__
    VALIDATE(k, v)
argopy\options.py:144: in VALIDATE
    if not _VALIDATORS[key](val):
argopy\options.py:90: in validate_gdac
    return check_gdac_option(this_path, errors="raise")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

path = 'C:\\Users\\runneradmin\\.argopy_tutorial_data\\ftp', errors = 'raise'

    def check_gdac_option(path, errors="ignore"):  # noqa: C901
        """Check if a path has the expected GDAC server structure
    
        Expected GDAC structure::
    
            .
            └── dac
                ├── aoml
                ├── ...
                ├── coriolis
                ├── ...
                ├── meds
                └── nmdis
    
        Examples::
    
        >>> check_gdac_option("https://data-argo.ifremer.fr")  # True
        >>> check_gdac_option("ftp://ftp.ifremer.fr/ifremer/argo") # True
        >>> check_gdac_option("ftp://usgodae..../pub/outgoing/argo") # True
        >>> check_gdac_option(".../home/ref-argo/gdac") # True
        >>> check_gdac_path("s3://argo-gdac-sandbox/") # True
        >>> check_gdac_option("https://www.ifremer.fr") # False
        >>> check_gdac_option("ftp://usgodae.org/pub/outgoing") # False
    
        Parameters
        ----------
        path: str
            Path name to check, including access protocol
        errors: str
            "ignore" or "raise" (or "warn")
    
        Returns
        -------
        checked: boolean
        """
        from .stores import gdacfs  # Otherwise raises circular import
    
        try:
            fs = gdacfs(path)
        except GdacPathError:
            if errors == "raise":
                raise
            elif errors == "warn":
                warnings.warn("Can't get address info (GAIerror) on '%s'" % path)
                return False
            else:
                return False
    
        check1 = fs.exists(fs.sep.join([path, "dac"]))
        if check1:
            return True
    
        elif errors == "raise":
>           raise GdacPathError(
                "This path is not GDAC compliant (no legitimate sub-folder `dac`):\n%s"
                % path
            )
E           argopy.errors.GdacPathError: This path is not GDAC compliant (no legitimate sub-folder `dac`):
E           C:\Users\runneradmin\.argopy_tutorial_data\ftp

argopy\options.py:353: GdacPathError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant