argopy.set_options#
- class set_options(**kwargs)[source]#
Set options for argopy
- Parameters:
ds (str, default:
phy
) β Define the Dataset to work with:phy
,bgc
orref
src (str, default:
erddap
) β Source of fetched data:erddap
,gdac
,argovis
mode (str, default:
standard
) β User mode:standard
,expert
orresearch
gdac (str, default: https://data-argo.ifremer.fr) β Default path to be used by the GDAC fetchers and Argo index stores
erddap (str, default: https://erddap.ifremer.fr/erddap) β Default server address to be used by the data and index erddap fetchers
cachedir (str, default:
~/.cache/argopy
) β Absolute path to a local cache directorycache_expiration (int, default: 86400) β Expiration delay of cache files in seconds
api_timeout (int, default: 60) β Time out for internet requests to web API, in seconds
trust_env (bool, default: False) β
Allow for local environment variables to be used to connect to the internet.
Argopy will get proxies information from HTTP_PROXY / HTTPS_PROXY environment variables if this option is True and it can also get proxy credentials from ~/.netrc file if this file exists
user (str, default: None) β Username to use when a simple authentication is required
password (str, default: None) β Password to use when a simple authentication is required
argovis_api_key (str, default:
guest
) βThe API key to use when fetching data from the argovis data source
You can get a free key at https://argovis-keygen.colorado.edu
parallel (bool, str,
distributed.Client
, default: False) βSet whether to use parallelisation or not, and possibly which method to use.
- Possible values:
False
: no parallelisation is usedTrue
: use default method specified by theparallel_default_method
option (see below)any other values accepted by the
parallel_default_method
option (see below)
parallel_default_method (str,
distributed.Client
, default:thread
) βThe default parallelisation method to use if the option
parallel
is simply set toTrue
.- Possible values:
thread
: use multi-threading with aconcurrent.futures.ThreadPoolExecutor
process
: use multi-processing with aconcurrent.futures.ProcessPoolExecutor
distributed.Client
: Use a Dask Cluster client.
server (: str, default: None) β
Other than expected/default server to be uses by a function/method
This is mostly intended to be used by unit tests.
Examples
You can use
set_options
either as a context manager for temporary setting:>>> import argopy >>> with argopy.set_options(src='gdac'): >>> ds = argopy.DataFetcher().float(3901530).to_xarray()
or to set global options (at the beginning of a script for instance):
>>> argopy.set_options(src='gdac')
- Warns:
A DeprecationWarning can be raised when a deprecated option is set
Methods
__init__
(**kwargs)