How-To: Calibrated CTX data

This is a brief how-to showing how the automatically handled raw data can be calibrated using ISIS and how the planetarypy module can help working with the calibrated data.

ImportantRequires the CTX package

This page uses functionality that ships separately as of planetarypy 0.82.0. Install it with pip install "planetarypy[ctx]" (or pip install planetarypy-ctx); a core-only install will not have it.

# import warnings
import warnings

import rasterio

from planetarypy.instruments.mro.ctx import Calib, Raw, CTXCollection

try:
    pass
except KeyError:
    warnings.warn("kalasiris has a problem initializing ISIS")
warnings.filterwarnings("ignore", category=rasterio.errors.NotGeoreferencedWarning)
pid = "B03_010694_1868_XI_06N285W"
pid = "D20_034983_1833_XN_03N284W"
raw = Raw(pid)
raw
Raw(pid='D20_034983_1833_XN_03N284W')
raw.path
Path('/Volumes/planet/Mars/CTX/pds/mrox_1961/D20_034983_1833_XN_03N284W.IMG')
cal = Calib(pid, destripe_to_calib=True)
cal.cub_path.exists()
True
coll = CTXCollection(list_of_pids=[pid])
coll.calibs
coll.cub_paths
coll.cal_paths
coll.map_paths
coll.geodataframe_path
[<planetarypy.instruments.mro.ctx.Calib at 0x3041aad50>]
[Path('/Users/maye/planetarypy_data/missions/mro/ctx/mrox_1961/D20_034983_1833_XN_03N284W/D20_034983_1833_XN_03N284W.cub')]
[Path('/Users/maye/planetarypy_data/missions/mro/ctx/mrox_1961/D20_034983_1833_XN_03N284W/D20_034983_1833_XN_03N284W.lev1.cub')]
[Path('/Users/maye/planetarypy_data/missions/mro/ctx/mrox_1961/D20_034983_1833_XN_03N284W/D20_034983_1833_XN_03N284W.lev2.cub')]
Path('footprints.gdf')
coll.write_isis_filelist(level=1)
cal.pipeline()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 1
----> 1 cal.pipeline()

NameError: name 'cal' is not defined
cal.cal_name
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 cal.cal_name

NameError: name 'cal' is not defined
cal.spatial_summing
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 cal.spatial_summing

NameError: name 'cal' is not defined
cal.isis_import()
Path('/mnt/slowdata/planetarypy/missions/mro/ctx/mrox_0721/B03_010694_1868_XI_06N285W/B03_010694_1868_XI_06N285W.cub')
cal.spice_init()
cal.calibrate(refresh=True)
Path('/mnt/slowdata/planetarypy/missions/mro/ctx/mrox_0721/B03_010694_1868_XI_06N285W/B03_010694_1868_XI_06N285W.lev1.cub')
cal.destripe()
cal.cal_path
Path('/mnt/slowdata/planetarypy/missions/mro/ctx/mrox_0721/B03_010694_1868_XI_06N285W/B03_010694_1868_XI_06N285W.lev1.cub')
cal.plot_any(cal.cal_path)