HiRISE

Data management for HiRISE data.

source

OBSID

 OBSID (obsid:str)

*Manage HiRISE observation ids.

For example PSP_003092_0985. phase is set to PSP for orbits < 11000, no setting required.*

Type Details
obsid str e.g. PSP_003092_0985
obsid = OBSID("PSP_003092_0985")
obsid
PSP_003092_0985
assert obsid.orbit == "003092"
assert obsid.targetcode == "0985"
assert obsid.phase == "PSP"
assert obsid.upper_orbit_folder == "ORB_003000_003099"
assert obsid.storage_path_stem == "PSP/ORB_003000_003099/PSP_003092_0985"

source

ProductPathfinder

 ProductPathfinder (initstr:str, check_url:bool=True)

*Determine paths and URLs for HiRISE RDR products (also EXTRAS.)

We use the PDS definition of PRODUCT_ID here, e.g. PSP_003092_0985_RED.

Attributes jp2_path and label_path get you the official RDR mosaic product, with kind steering if you get the COLOR or the RED product. All other properties go to the RDR/EXTRAS folder. The “PDS” part of the path is handled in the OBSID class.*

Type Default Details
initstr str PRODUCT_ID string, e.g. PSP_003092_0985_RED
check_url bool True for performance, the user might not want the url check
pid = "ESP_039983_1390_RED"
ppf = ProductPathfinder(pid)
ppf.storage_stem
'ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED'
ppf.local_label_path.exists()
False
ppf.edr_storage_stem
Path('EDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED')
ppf.download_label()
Path('/home/ayek72/mnt/slowdata/planetarypy/missions/mro/hirise/ESP_039983_1390/ESP_039983_1390_RED.LBL')
ppf.go_to_homepage()
4;1HPS connection to uahirise.org[22;24H                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Getting https://uahirise.org/ESP_039983_1390                                    
ppf.homepage
'https://uahirise.org/ESP_039983_1390'
assert isinstance(ppf.obsid, OBSID)
assert ppf.kind == "RED"
assert ppf.label_fname == "ESP_039983_1390_RED.LBL"
assert ppf.label_path == Path('RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.LBL')

Paths and URLS

Each xxx_path attribute is also available as xxx_url, and accessing the _url parameter immediately checks for its existence on the server.

# little helper to show attributes inside ProductPathfinder object...
def _isprop(v):
    return isinstance(v, property)


def _get_properties(classname, substring):
    names = [name for (name, value) in inspect.getmembers(classname, _isprop) if name.endswith(substring)]
    return names
# Here I'm checking that all _url versions work, each access checks for existence:
for prop in _get_properties(ProductPathfinder, "_path"):
    if prop.startswith("local_label"):
        continue
    print(prop)
    print(getattr(ppf, prop))
    urlattr = prop.replace("_path", "_url")
    print(urlattr)
    url = getattr(ppf, urlattr)
    print(url)
abrowse_path
EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.abrowse.jpg
abrowse_url
https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.abrowse.jpg
browse_path
EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.browse.jpg
browse_url
https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.browse.jpg
jp2_path
RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.JP2
jp2_url
https://hirise-pds.lpl.arizona.edu/PDS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.JP2
label_path
RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.LBL
label_url
https://hirise-pds.lpl.arizona.edu/PDS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.LBL
nomap_browse_path
EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.browse.jpg
nomap_browse_url
https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.browse.jpg
nomap_jp2_path
EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.JP2
nomap_jp2_url
https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.JP2
nomap_thumbnail_path
EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.thumb.jpg
nomap_thumbnail_url
https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.thumb.jpg
quicklook_path
EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.QLOOK.JP2
quicklook_url
https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.QLOOK.JP2
thumbnail_path
EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.thumb.jpg
thumbnail_url
https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.thumb.jpg
ppf.storage_stem
'ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED'
ppf.nomap_browse_url
URL('https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.browse.jpg')
ppf.abrowse_url
URL('https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.abrowse.jpg')
ppf.nomap_jp2_path
'EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED.NOMAP.JP2'

source

COLOR_PRODUCT

 COLOR_PRODUCT (obsid)

Initialize self. See help(type(self)) for accurate signature.


source

RGB_NOMAP

 RGB_NOMAP (obsid)

Initialize self. See help(type(self)) for accurate signature.

obsid = "ESP_039983_1390"
rgb = RGB_NOMAP(obsid)
rgb.obsid
'ESP_039983_1390'
rgb.product_id
'ESP_039983_1390_RGB'
rgb.meta.head()
volume_id                                                         MROHR_0001
file_name_specification    RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_...
instrument_host_id                                                       MRO
instrument_id                                                         HIRISE
observation_id                                               ESP_039983_1390
Name: 75508, dtype: object
rgb.local_path
Path('/home/ayek72/mnt/slowdata/planetarypy/missions/mro/hirise/ESP_039983_1390/ESP_039983_1390_RGB.NOMAP.JP2')
rgb.url
URL('https://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RGB.NOMAP.JP2')
rgb.download(overwrite=False)
File exists. Use `overwrite=True` to download fresh.
rgb.read()
<xarray.DataArray (band: 3, y: 20000, x: 2024)>
dask.array<open_rasterio-3e88685e58afe3daaabd13b6ff29c609<this-array>, shape=(3, 20000, 2024), dtype=uint16, chunksize=(1, 2024, 2024), chunktype=numpy.ndarray>
Coordinates:
  * band         (band) int64 1 2 3
  * x            (x) float64 0.5 1.5 2.5 3.5 ... 2.022e+03 2.022e+03 2.024e+03
  * y            (y) float64 0.5 1.5 2.5 3.5 4.5 ... 2e+04 2e+04 2e+04 2e+04
    spatial_ref  int64 0
Attributes:
    scale_factor:  1.0
    add_offset:    0.0
rgb.show(xslice=slice(1000, 2000), yslice=slice(16000, 18000))

source

RGB_NOMAPCollection

 RGB_NOMAPCollection (obsids)

Class to deal with a set of RGB_NOMAP products.

/home/runner/micromamba/envs/my-env/lib/python3.12/site-packages/fastcore/docscrape.py:225: UserWarning: Unknown section Example
  else: warn(msg)

source

SOURCE_PRODUCT

 SOURCE_PRODUCT (spid, saveroot=None, check_url=True)

Manage SOURCE_PRODUCT id.

obsid = 'ESP_027021_1525_RED'
for i in range(10):
    for ch in [0, 1]:
        spid = f"{obsid}{i}_{ch}"
        try:
            SOURCE_PRODUCT(spid).download()
        except ConnectionError:
            pass
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
File exists. Use `overwrite=True` to download fresh.
/tmp/ipykernel_1172729/2293453911.py:88: UserWarning: https://hirise-pds.lpl.arizona.edu/PDS/EDR/ESP/ORB_027000_027099/ESP_027021_1525/ESP_027021_1525_RED9_0.IMG does not exist on the server.
  warnings.warn(f"{u} does not exist on the server.")
/tmp/ipykernel_1172729/2293453911.py:88: UserWarning: https://hirise-pds.lpl.arizona.edu/PDS/EDR/ESP/ORB_027000_027099/ESP_027021_1525/ESP_027021_1525_RED9_1.IMG does not exist on the server.
  warnings.warn(f"{u} does not exist on the server.")
sp = SOURCE_PRODUCT("ESP_027021_1525_RED0_0")
sp.local_path
Path('/home/ayek72/mnt/slowdata/planetarypy/missions/mro/hirise/ESP_027021_1525/ESP_027021_1525_RED0_0.IMG')
sp.download()
File exists. Use `overwrite=True` to download fresh.
sp.stitched_cube_path
Path('/home/ayek72/mnt/slowdata/planetarypy/missions/mro/hirise/ESP_027021_1525/ESP_027021_1525_RED0.cub')
sp.url
URL('https://hirise-pds.lpl.arizona.edu/PDS/EDR/ESP/ORB_027000_027099/ESP_027021_1525/ESP_027021_1525_RED0_0.IMG')
sp.remote_path
Path('EDR/ESP/ORB_027000_027099/ESP_027021_1525/ESP_027021_1525_RED0_0.IMG')
sp.local_path
Path('/home/ayek72/mnt/slowdata/planetarypy/missions/mro/hirise/ESP_027021_1525/ESP_027021_1525_RED0_0.IMG')
sp.channel
'0'
sp.ccd
'RED0'
sp.color
'RED'
sp.ccdno
'0'
sp.spid
'ESP_027021_1525_RED0_0'
sp
SOURCE_PRODUCT: ESP_027021_1525_RED0_0
sp.fname
'ESP_027021_1525_RED0_0.IMG'
sp.local_cube
Path('/home/ayek72/mnt/slowdata/planetarypy/missions/mro/hirise/ESP_027021_1525/ESP_027021_1525_RED0_0.cub')
sp.stitched_cube_name
'ESP_027021_1525_RED0.cub'
sp.stitched_cube_path.exists()
True

source

RED_PRODUCT

 RED_PRODUCT (obsid, ccdno, channel, **kwargs)

This exists to support creating a RED_PRODUCT_ID from parts of a SOURCE_PRODUCT id.

RED_PRODUCT("ESP_027021_1525", 4, 0).channel
'0'
rpid = RED_PRODUCT("ESP_039983_1390", "4", "0")
rpid.spid
'ESP_039983_1390_RED4_0'
rpid.fname
'ESP_039983_1390_RED4_0.IMG'
rpid.url
URL('https://hirise-pds.lpl.arizona.edu/PDS/EDR/ESP/ORB_039900_039999/ESP_039983_1390/ESP_039983_1390_RED4_0.IMG')
rpid.download()
File exists. Use `overwrite=True` to download fresh.

source

BG_PRODUCT

 BG_PRODUCT (obsid, ccdno, channel)

Manage SOURCE_PRODUCT id.


source

IR_PRODUCT

 IR_PRODUCT (obsid, ccdno, channel)

Manage SOURCE_PRODUCT id.


source

RedMosaic

 RedMosaic (obsid)

Initialize self. See help(type(self)) for accurate signature.

obsid = "ESP_027021_1525"
red = RedMosaic(obsid)
!ls {red.local_path.parent}
B01_009958_1524_XI_27S347W.cal.cub   ESP_027021_1525_RED4_1.IMG
B01_009958_1524_XI_27S347W.lev2.cub  ESP_027021_1525_RED4.cub
cube2.lis                            ESP_027021_1525_RED4.map.cub
cube.lis                             ESP_027021_1525_RED4.norm.cub
ESP_027021_1525_RED0_0.cal.cub       ESP_027021_1525_RED5_0.cal.cub
ESP_027021_1525_RED0_0.cub           ESP_027021_1525_RED5_0.cub
ESP_027021_1525_RED0_0.hical.log     ESP_027021_1525_RED5_0.hical.log
ESP_027021_1525_RED0_0.IMG           ESP_027021_1525_RED5_0.IMG
ESP_027021_1525_RED0_1.cal.cub       ESP_027021_1525_RED5_1.cal.cub
ESP_027021_1525_RED0_1.cub           ESP_027021_1525_RED5_1.cub
ESP_027021_1525_RED0_1.hical.log     ESP_027021_1525_RED5_1.hical.log
ESP_027021_1525_RED0_1.IMG           ESP_027021_1525_RED5_1.IMG
ESP_027021_1525_RED0.cub             ESP_027021_1525_RED5.cub
ESP_027021_1525_RED0.map.cub         ESP_027021_1525_RED5.map.cub
ESP_027021_1525_RED0.norm.cub        ESP_027021_1525_RED5.map.cub.aux.xml
ESP_027021_1525_RED1_0.cal.cub       ESP_027021_1525_RED5.norm.cub
ESP_027021_1525_RED1_0.cub           ESP_027021_1525_RED6_0.cal.cub
ESP_027021_1525_RED1_0.hical.log     ESP_027021_1525_RED6_0.cub
ESP_027021_1525_RED1_0.IMG           ESP_027021_1525_RED6_0.hical.log
ESP_027021_1525_RED1_1.cal.cub       ESP_027021_1525_RED6_0.IMG
ESP_027021_1525_RED1_1.cub           ESP_027021_1525_RED6_1.cal.cub
ESP_027021_1525_RED1_1.hical.log     ESP_027021_1525_RED6_1.cub
ESP_027021_1525_RED1_1.IMG           ESP_027021_1525_RED6_1.hical.log
ESP_027021_1525_RED1.cub             ESP_027021_1525_RED6_1.IMG
ESP_027021_1525_RED1.map.cub         ESP_027021_1525_RED6.cub
ESP_027021_1525_RED1.norm.cub        ESP_027021_1525_RED6.map.cub
ESP_027021_1525_RED2_0.cal.cub       ESP_027021_1525_RED6.norm.cub
ESP_027021_1525_RED2_0.cub           ESP_027021_1525_RED7_0.cal.cub
ESP_027021_1525_RED2_0.hical.log     ESP_027021_1525_RED7_0.cub
ESP_027021_1525_RED2_0.IMG           ESP_027021_1525_RED7_0.hical.log
ESP_027021_1525_RED2_1.cal.cub       ESP_027021_1525_RED7_0.IMG
ESP_027021_1525_RED2_1.cub           ESP_027021_1525_RED7_1.cal.cub
ESP_027021_1525_RED2_1.hical.log     ESP_027021_1525_RED7_1.cub
ESP_027021_1525_RED2_1.IMG           ESP_027021_1525_RED7_1.hical.log
ESP_027021_1525_RED2.cub             ESP_027021_1525_RED7_1.IMG
ESP_027021_1525_RED2.map.cub         ESP_027021_1525_RED7.cub
ESP_027021_1525_RED2.norm.cub        ESP_027021_1525_RED7.map.cub
ESP_027021_1525_RED3_0.cal.cub       ESP_027021_1525_RED7.norm.cub
ESP_027021_1525_RED3_0.cub           ESP_027021_1525_RED8_0.cal.cub
ESP_027021_1525_RED3_0.hical.log     ESP_027021_1525_RED8_0.cub
ESP_027021_1525_RED3_0.IMG           ESP_027021_1525_RED8_0.hical.log
ESP_027021_1525_RED3_1.cal.cub       ESP_027021_1525_RED8_0.IMG
ESP_027021_1525_RED3_1.cub           ESP_027021_1525_RED8_1.cal.cub
ESP_027021_1525_RED3_1.hical.log     ESP_027021_1525_RED8_1.cub
ESP_027021_1525_RED3_1.IMG           ESP_027021_1525_RED8_1.hical.log
ESP_027021_1525_RED3.cub             ESP_027021_1525_RED8_1.IMG
ESP_027021_1525_RED3.map.cub         ESP_027021_1525_RED8.cub
ESP_027021_1525_RED3.norm.cub        ESP_027021_1525_RED8.map.cub
ESP_027021_1525_RED4_0.cal.cub       ESP_027021_1525_RED8.norm.cub
ESP_027021_1525_RED4_0.cub           ESP_027021_1525_RED.LBL
ESP_027021_1525_RED4_0.hical.log     normalized.lis
ESP_027021_1525_RED4_0.IMG           point.txt
ESP_027021_1525_RED4_1.cal.cub       print.prt
ESP_027021_1525_RED4_1.cub           set_overlaps.txt
ESP_027021_1525_RED4_1.hical.log