In [1]:
# setup 
from pyrise import products as prod

obsid = prod.OBSERVATION_ID('PSP_003072_0985')

In [2]:
# test orbit number
assert obsid.orbit == '003072'

In [3]:
# test setting orbit property
obsid.orbit = 4080
assert obsid.orbit == '004080'

In [4]:
# test repr
assert obsid.__repr__() == 'PSP_004080_0985'

In [5]:
# test targetcode
assert obsid.targetcode == '0985'

In [6]:
# test setting targetcode property
obsid.targetcode = '0980'
assert obsid.targetcode == '0980'
assert obsid.__repr__() == 'PSP_004080_0980'

In [7]:
# test phase
assert obsid.phase == 'PSP'

In [8]:
# test upper orbit folder
assert obsid.get_upper_orbit_folder() == 'ORB_004000_004099'

In [9]:
# test storage path stem
assert obsid.storage_path_stem == 'PSP/ORB_004000_004099/PSP_004080_0980'

PRODUCT_ID


In [10]:
pid = prod.PRODUCT_ID('PSP_003072_0985')
pid


Out[10]:
PSP_003072_0985_None

In [11]:
pid.kind = 'RED'
pid


Out[11]:
PSP_003072_0985_RED

In [12]:
pid.s


Out[12]:
'PSP_003072_0985_RED'

In [13]:
pid.storage_stem


Out[13]:
'PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED'

In [14]:
pid.label_fname


Out[14]:
'PSP_003072_0985_RED.LBL'

In [15]:
pid.label_path


Out[15]:
'RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.LBL'

In [16]:
pid.jp2_fname


Out[16]:
'PSP_003072_0985_RED.JP2'

In [17]:
pid.jp2_path


Out[17]:
'RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.JP2'

In [18]:
for item in dir(pid):
    if not item.startswith('__'):
        print(item,':')
        print(getattr(pid, item))
        print()


_kind :
RED

abrowse_path :
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.abrowse.jpg

browse_path :
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.browse.jpg

edr_storage_stem :
EDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED

from_path :
<bound method PRODUCT_ID.from_path of <class 'pyrise.products.PRODUCT_ID'>>

jp2_fname :
PSP_003072_0985_RED.JP2

jp2_path :
RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.JP2

kind :
RED

kinds :
['RED', 'BG', 'IR', 'COLOR', 'IRB', 'MIRB', 'MRGB', 'RGB']

label_fname :
PSP_003072_0985_RED.LBL

label_path :
RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.LBL

label_url :
https://hirise-pds.lpl.arizona.edu/PDS/RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.LBL

nomap_browse_path :
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.NOMAP.browse.jpg

nomap_jp2_path :
RDR/EXTRAS/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.NOMAP.JP2

nomap_thumbnail_path :
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.NOMAP.thumb.jpg

obsid :
PSP_003072_0985

quicklook_path :
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.QLOOK.JP2

s :
PSP_003072_0985_RED

storage_stem :
PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED

thumbnail_path :
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.thumb.jpg

SOURCE_PRODUCT_ID


In [19]:
spid = prod.SOURCE_PRODUCT_ID('PSP_003092_0985_RED4_0')
spid


Out[19]:
SOURCE_PRODUCT_ID: PSP_003092_0985_RED4_0

In [20]:
spid.channel = 1

In [21]:
spid


Out[21]:
SOURCE_PRODUCT_ID: PSP_003092_0985_RED4_1

In [22]:
spid.ccd


Out[22]:
'RED4'

In [23]:
for i in dir(spid):
    if not i.startswith('__'):
        print(i,':')
        print(getattr(spid, i))
        print()


_ccd :
RED4

_channel :
1

_parse_ccd :
<bound method SOURCE_PRODUCT_ID._parse_ccd of SOURCE_PRODUCT_ID: PSP_003092_0985_RED4_1>

bg_ccds :
['BG12', 'BG13']

ccd :
RED4

ccdno :
4

ccds :
['RED0', 'RED1', 'RED2', 'RED3', 'RED4', 'RED5', 'RED6', 'RED7', 'RED8', 'RED9', 'IR10', 'IR11', 'BG12', 'BG13']

channel :
1

color :
RED

download :
<bound method SOURCE_PRODUCT_ID.download of SOURCE_PRODUCT_ID: PSP_003092_0985_RED4_1>

fname :
PSP_003092_0985_RED4_1.IMG

fpath :
EDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED4_1.IMG

furl :
https://hirise-pds.lpl.arizona.edu/PDS/EDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED4_1.IMG

ir_ccds :
['IR10', 'IR11']

local_cube :
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-23-c32cc707b698> in <module>()
      2     if not i.startswith('__'):
      3         print(i,':')
----> 4         print(getattr(spid, i))
      5         print()

~/Dropbox/src/pyrise/pyrise/products.py in local_cube(self)
    345     @property
    346     def local_cube(self):
--> 347         return self.local_path.with_suffix('.cub')
    348 
    349     @property

~/Dropbox/src/pyrise/pyrise/products.py in local_path(self)
    362     @property
    363     def local_path(self):
--> 364         savepath = self.saveroot / str(self.obsid) / self.fname
    365         return savepath
    366 

TypeError: unsupported operand type(s) for /: 'NoneType' and 'str'

In [24]:
spid.pid.storage_stem


Out[24]:
'PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED'

In [25]:
spid.pid.edr_storage_stem


Out[25]:
'EDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED'

In [26]:
spid.fpath


Out[26]:
PosixPath('EDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED4_1.IMG')

HiRISE_URL


In [27]:
hiurl = prod.HiRISE_URL(spid.fpath)
hiurl.url


Out[27]:
'https://hirise-pds.lpl.arizona.edu/PDS/EDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED4_1.IMG'

In [28]:
hiurl.path


Out[28]:
'/PDS/EDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED4_1.IMG'

others


In [29]:
pid.label_path


Out[29]:
'RDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED.LBL'

In [30]:
pid.obsid


Out[30]:
PSP_003072_0985

In [31]:
pid


Out[31]:
PSP_003072_0985_RED

In [32]:
prod.RED_PRODUCT_ID(pid.obsid.s, 4, 1).furl


Out[32]:
'https://hirise-pds.lpl.arizona.edu/PDS/EDR/PSP/ORB_003000_003099/PSP_003072_0985/PSP_003072_0985_RED4_1.IMG'

In [33]:
prod.RED_PRODUCT_ID(pid.obsid.s, 4,1)


Out[33]:
RED_PRODUCT_ID: PSP_003072_0985_RED4_1

In [34]:
from pyrise import downloads

In [35]:
obsid = 'PSP_003092_0985'
downloads.download_RED_product(obsid, 4, 0)


Downloading
 https://hirise-pds.lpl.arizona.edu/PDS/EDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED4_0.IMG 
to
 /Users/klay6683/Dropbox/data/hirise/PSP_003092_0985/PSP_003092_0985_RED4_0.IMG
Out[35]:
PosixPath('/Users/klay6683/Dropbox/data/hirise/PSP_003092_0985/PSP_003092_0985_RED4_0.IMG')

In [36]:
red_pid = prod.RED_PRODUCT_ID(pid.obsid.s, 4,1)

In [37]:
red_pid.fname


Out[37]:
'PSP_003072_0985_RED4_1.IMG'

In [38]:
pid


Out[38]:
PSP_003072_0985_RED

In [39]:
name = obsid + '_RED'
channels = [4, 5]
ccds = [0, 1]

for channel in channels:
    for ccd in ccds:
        print(f'{name}{channel}_0.cub')


PSP_003092_0985_RED4_0.cub
PSP_003092_0985_RED4_0.cub
PSP_003092_0985_RED5_0.cub
PSP_003092_0985_RED5_0.cub

In [40]:
sid = prod.RED_PRODUCT_ID(obsid, 4,0)

In [41]:
sid.pid.label_url


Out[41]:
'https://hirise-pds.lpl.arizona.edu/PDS/RDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED.LBL'

In [ ]: