def reference_uri_to_cache_path(reference_uri, observatory=None): """Convert an abstract CRDS reference file URI into an absolute path for the file as located in the CRDS cache. Parameters ---------- reference_uri : string identifying an abstract CRDS reference file, .e.g. 'crds://jwst_miri_flat_0177.fits' observatory : string naming the telescope/project for CRDS, e.g. 'jwst' `observatory` should be omitted, None, or defined as a literal string value. Omission and the value None are interpreted as 'jwst'. Returns ------- reference_path : absolute file path to reference_uri in the CRDS cache, .e.g. '/grp/crds/cache/references/jwst/jwst_miri_flat_0177.fits' Standard CRDS cache paths are typically defined relative to the CRDS_PATH environment variable. See https://jwst-crds.stsci.edu guide and top level page for more info on configuring CRDS. The default CRDS_PATH value is /grp/crds/cache, currently on the Central Store. """ if not reference_uri.startswith("crds://"): raise exceptions.CrdsError( "CRDS reference URI's should start with 'crds://' but got", repr(reference_uri)) observatory = (observatory or 'jwst').lower() basename = config.pop_crds_uri(reference_uri) return crds.locate_file(basename, observatory)
def reference_uri_to_cache_path(reference_uri): """Convert an abstract CRDS reference file URI into an absolute path for the file as located in the CRDS cache. e.g. 'crds://jwst_miri_flat_0177.fits' --> '/grp/crds/cache/references/jwst/jwst_miri_flat_0177.fits' Standard CRDS cache paths are typically defined relative to the CRDS_PATH environment variable. See https://jwst-crds.stsci.edu guide and top level page for more info on configuring CRDS. The default CRDS_PATH value is /grp/crds/cache, currently on the Central Store. """ if not reference_uri.startswith("crds://"): raise exceptions.CrdsError("CRDS reference URI's should start with 'crds://' but got", repr(reference_uri)) basename = config.pop_crds_uri(reference_uri) return crds.locate_file(basename, "jwst")
def reference_uri_to_cache_path(reference_uri): """Convert an abstract CRDS reference file URI into an absolute path for the file as located in the CRDS cache. e.g. 'crds://jwst_miri_flat_0177.fits' --> '/grp/crds/cache/references/jwst/jwst_miri_flat_0177.fits' Standard CRDS cache paths are typically defined relative to the CRDS_PATH environment variable. See https://jwst-crds.stsci.edu guide and top level page for more info on configuring CRDS. The default CRDS_PATH value is /grp/crds/cache, currently on the Central Store. """ if not reference_uri.startswith("crds://"): raise exceptions.CrdsError( "CRDS reference URI's should start with 'crds://' but got", repr(reference_uri)) basename = config.pop_crds_uri(reference_uri) return crds.locate_file(basename, "jwst")