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

[WIP] Data fetcher for a local GDAC ftp copy #5

Merged
merged 68 commits into from
Apr 3, 2020

Conversation

gmaze
Copy link
Member

@gmaze gmaze commented Mar 18, 2020

Many users or institutes work with a local copy of a GDAC ftp.

GDAC ftp (from Argo-France at Coriolis or Argo-US at AOML) are the official, and only reliable, Argo data access point.

Here, I want to merge work from https://github.com/euroargodev/argopy-osnet to the official argopy.

The resulting API may look like:

    from argopy import DataFetcher as ArgoDataFetcher
    argo_loader = ArgoDataFetcher(backend='localftp')

    argo_loader.region([-85,-45,10.,20.,0,1000.]).to_xarray()
    argo_loader.profile(6902746, 34).to_xarray()
    argo_loader.float([6902746, 6902747, 6902757, 6902766]).to_xarray()

@gmaze gmaze self-assigned this Mar 18, 2020
@gmaze gmaze linked an issue Mar 18, 2020 that may be closed by this pull request
gmaze added 14 commits March 18, 2020 12:34
- Data fetchers are responsible for:
  - loading all available data from a given source
  - making data compliant to Argo standards (data type, variable name, attributes, etc ...)
  - providing the end-user API (argopy.fetchers.ArgoDataFetcher) methods to filter data
    according to user level or requests. These must includes:
      1. filter_data_mode
      1. filter_qc
      1. filter_variables
More cast_types
@gmaze gmaze added enhancement New feature or request New feature labels Mar 23, 2020
@gmaze gmaze requested a review from quai20 March 23, 2020 11:14
Arising from recent update at #11
This was required to avoid managing local ftp path.
This commit creates ``argopy.set_options()`` to be used directly or within a context.
@gmaze gmaze linked an issue Mar 23, 2020 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Apr 1, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@8db54e3). Click here to learn what that means.
The diff coverage is 77.53%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #5   +/-   ##
=========================================
  Coverage          ?   77.76%           
=========================================
  Files             ?       10           
  Lines             ?     1030           
  Branches          ?        0           
=========================================
  Hits              ?      801           
  Misses            ?      229           
  Partials          ?        0
Flag Coverage Δ
#unittests 77.47% <77.07%> (?)
Impacted Files Coverage Δ
setup.py 0% <ø> (ø)
argopy/errors.py 63.15% <63.15%> (ø)
argopy/xarray.py 66.09% <63.83%> (ø)
argopy/data_fetchers/proto.py 71.42% <71.42%> (ø)
argopy/data_fetchers/localftp.py 81.56% <81.56%> (ø)
argopy/utilities.py 65.95% <81.81%> (ø)
argopy/fetchers.py 90% <84.31%> (ø)
argopy/tutorial.py 91.37% <91.37%> (ø)
argopy/data_fetchers/erddap.py 82.82% <94.33%> (ø)
argopy/options.py 96.66% <96.66%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8db54e3...58f60fe. Read the comment docs.

Copy link
Member

@quai20 quai20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't test much but no surprises so far. I let you merge the branch, I'll test more on master.

Copy link
Member Author

@gmaze gmaze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's new

Features and front-end API

  • Added new data fetcher backend localftp in ArgoDataFetcher (c5f7cb6):
from argopy import DataFetcher as ArgoDataFetcher
argo_loader = ArgoDataFetcher(backend='localftp', path_ftp='/data/Argo/ftp_copy')
argo_loader.float(6902746).to_xarray()
  • Introduced global OPTIONS to set values for: cache folder, dataset (eg:'phy' or 'bgc'), local ftp path, data fetcher ('erddap' or 'localftp') and user level ('standard' or 'expert'). Can be used in context with (83ccfb5):
with argopy.set_options(mode='expert', datasrc='erddap'):
    ds = argopy.DataFetcher().float(3901530).to_xarray()
  • Added a argopy.tutorial module to be able to load sample data for documentation and unit testing (4af09b5):
ftproot, flist = argopy.tutorial.open_dataset('localftp')
txtfile = argopy.tutorial.open_dataset('weekly_index_prof')
  • Improved xarray argo accessor. Added methods for casting data types, to filter variables according to data mode, to filter variables according to quality flags. Useful methods to transform collection of points into collection of profiles, and vice versa (14cda55):
ds = argopy.DataFetcher().float(3901530).to_xarray() # get a collection of points
dsprof = ds.argo.point2profile() # transform to profiles
ds = dsprof.argo.profile2point() # transform to points
  • Changed License from MIT to Apache (25f90c9)

Inner machinery

  • Add __all__ to control from argopy import * (83ccfb5)
  • All data fetchers inherit from class ArgoDataFetcherProto in proto.py (44f45a5)
  • Data fetchers use default options from global OPTIONS
  • In Erddap fetcher: methods to cast data type, to filter by data mode and by QC flags are now delegated to the xarray argo accessor methods.
  • Data fetchers methods to filter variables according to user mode are using variable lists defined in utilities.
  • argopy.utilities augmented with listing functions of: backends, standard variables and multiprofile files variables.
  • Introduce custom errors in errors.py (2563c9f)
  • Front-end API ArgoDataFetcher uses a more general way of auto-discovering fetcher backend and their access points. Turned of the deployments access point, waiting for the index fetcher to do that.
  • Improved xarray argo accessor. More reliable point2profile and data type casting with cast_type

Code management

  • Add CI with github actions (ecbf9ba)
  • Contribution guideline for data fetchers (b332495)
  • Improve unit testing (all along commits)
  • Introduce code coverage (b490ab5)
  • Added explicit support for python 3.6 , 3.7 and 3.8 (58f60fe)

@gmaze gmaze merged commit 6280331 into master Apr 3, 2020
@gmaze gmaze mentioned this pull request Apr 3, 2020
4 tasks
@gmaze gmaze deleted the feature-fetch-local-ftp branch April 3, 2020 17:35
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.

General options Implement data fetcher for a local copy of the GDAC ftp
2 participants