[2]:
import argopy
from argopy import DataFetcher as ArgoDataFetcher
/home/docs/checkouts/readthedocs.org/user_builds/argopy/checkouts/v0.1.3/argopy/plotters.py:31: UserWarning: argopy requires cartopy installed for full map plotting functionality
  warnings.warn("argopy requires cartopy installed for full map plotting functionality")

Performance

Caching data

If you want to avoid retrieving the same data serveral time during a working session, or if you fetched a large amount of data, you may want to temporarily save data in a cache file.

You can cache fetched data with the fetchers option cache. Note that cached data will persists on the machine they are retrieved as long as you don’t clear the cache.

Note

At this point, caching is only available for:

The default cache folder is under your home directory at ~./.cache/argopy. But you can specify the path you want to use in several ways:

  • with argopy global options:
[3]:
argopy.set_options(cachedir='mycache_folder')
[3]:
<argopy.options.set_options at 0x7fcebc2adef0>
  • in a temporary context:
[4]:
with argopy.set_options(cachedir='mycache_folder'):
    ds = ArgoDataFetcher(cache=True).profile(6902746, 34).to_xarray()
  • when instantiating the data fetcher:
[5]:
ds = ArgoDataFetcher(cache=True, cachedir='mycache_folder').profile(6902746, 34).to_xarray()

Warning

You really need to set the cache option to True. Specifying only the cachedir won’t trigger caching !