geowatch.utils.util_girder module¶
- geowatch.utils.util_girder.grabdata_girder(api_url, resource_id, name=None, dpath=None, hash_prefix=None, appname='geowatch/girder', api_key=None, verbose=1)[source]¶
Downloads and caches a file or folder from girder.
- Parameters:
api_url (str) – the URL to the girder server
resource_id (str) – the id of the resource (e.g. file or folder).
name (str, default=None) – the desired name of the downloaded resource on disk if unspecified, the name of the resource on the girder server will be used.
dapth (str, default=None) – the path to download the resource to
hash_prefix (str, default=None) – If provided, and the item is a file, check that the prefix of the hash provided by girder matches this prefix. If the item is a folder, then this is not used.
appname (str, default=’geowatch’) – if
dpath
is not given, then the ubelt app_cache_dir for this application name is used.api_key (str) – Your API key to autheticate with to access private data. If unspecified the
GIRDER_API_KEY
environ is used.verbose (int, default=1) – verbosity flag, if non-zero prints download progress.
- Requirements:
pip install girder-client
Example
>>> # xdoctest: +REQUIRES(--network) >>> from geowatch.utils.util_girder import * # NOQA >>> from os.path import basename >>> api_url = 'https://data.kitware.com/api/v1' >>> resource_id = '59eb64678d777f31ac6477eb' >>> fpath = grabdata_girder(api_url, resource_id, >>> hash_prefix='79974f400aa50') >>> assert basename(fpath) == 'us.json' >>> resource_id = '59eb64298d777f31ac6477e8' >>> fpath = grabdata_girder(api_url, resource_id) >>> assert basename(fpath) == 'boundries'