rbeyer / kalasiris

A Python library to wrap functions and functionality for the Integrated Software for Imagers and Spectrometers (ISIS).
https://kalasiris.readthedocs.io
BSD 3-Clause "New" or "Revised" License
9 stars 5 forks source link

getsn returning Unkown for KaguyaTC images with ISIS4.0.0 ISISROOT #8

Closed ladoramkershner closed 3 years ago

ladoramkershner commented 3 years ago

Describe the bug getsn returns Unknown for Kaguya TC images, which is a known issue for ISIS versions 4.0.1+ even though ISISROOT and ISISDATA are set to isis4.0.0

To Reproduce In a jupyter notebook, run

import os
os.environ['ISISROOT'] = '/path/to/anaconda3/envs/isis4.0.0'
os.environ['ISISDATA'] = '/path/to/isis_data/'

cube = '/path/to/TC1W2B0_01_01069N027E3061.cub'
isis.getsn(cube)

Returns

CompletedProcess(args=['getsn', 'from=/super/secret/path/TC1W2B0_01_01069N027E3061.cub'], returncode=0, stdout='Unknown\n', stderr='')

Expected behavior If I hop onto the terminal, activate the same env, and run an equivalent command:

conda activate /path/to/anaconda3/envs/isis4.0.0
getsn from=/path/to/TC1W2B0_01_01069N027E3061.cub

I get the serialnumber

KAGUYA/TC1/2008-01-05T02:38:00.961757

Error logs or terminal captures NA

Your Environment (please complete the following information):

Additional context This is not specific to the cube I have listed here, so any Kaguya TC image will work.

jessemapel commented 3 years ago

@ladoramkershner Do you have the print.prt files from these runs? kalasiris should still produce a print.prt file.

ladoramkershner commented 3 years ago

Yup! The only difference I saw between the two calls was that the kalasiris has an Unknown user. This may be an issue since I am using a shared isis conda environment.

Object = getsn
  IsisVersion       = "4.0.0  | 2020-02-04"
  ProgramVersion    = 2018-01-17
  ProgramPath       = /path/to/anaconda3/envs/isis4.0.0/bin
  ExecutionDateTime = 2021-09-09T14:40:55
  HostName          = Unknown
  UserName          = Unknown
  Description       = "Prints Image Serial Number"

  Group = UserParameters
    FROM        = /path/to/TC1W2B0_01_01069N027E3061.cub
    APPEND      = TRUE
    DEFAULT     = FALSE
    FILE        = False
    SN          = True
    OBSERVATION = False
    FORMAT      = PVL
  End_Group

  Group = Results
    SerialNumber = Unknown
  End_Group

  Group = Accounting
    ConnectTime = 00:00:00.0
    CpuTime     = 00:00:00.3
  End_Group
End_Object

command line call

Object = getsn
  IsisVersion       = "4.0.0  | 2020-02-04"
  ProgramVersion    = 2018-01-17
  ProgramPath       = /path/to/anaconda3_linux/envs/isis4.0.0/bin
  ExecutionDateTime = 2021-09-09T14:45:09
  HostName          = Unknown
  UserName          = ladoramkershner
  Description       = "Prints Image Serial Number"

  Group = UserParameters
    FROM        = /path/to/TC1W2B0_01_01069N027E3061.cub
    APPEND      = TRUE
    DEFAULT     = FALSE
    FILE        = False
    SN          = True
    OBSERVATION = False
    FORMAT      = PVL
  End_Group

  Group = Results
    SerialNumber = KAGUYA/TC1/2008-01-05T02:38:00.961757
  End_Group

  Group = Accounting
    ConnectTime = 00:00:00.0
    CpuTime     = 00:00:00.3
  End_Group
End_Object

To test if this was the issue, I tried running the kalasiris command on a CTX image which has no known serial number generation issues. I also got 'Unknown' returned. So this may be more an issue of setting a user in a way ISIS can pick up on and only an issue when using shared conda environements...

jessemapel commented 3 years ago

I think you may have your data area setup wrong. ISIS 4.0.0 still uses ISIS3DATA for its data environment variable, see here.

Try setting os.environ['ISIS3DATA'] = '/path/to/isis_data/' and make sure you point to the old data area and not the new one. Check what ISIS3DATA resolves to when you just activate the isis4.0.0 environment internally.

ladoramkershner commented 3 years ago

That was it... Thanks Jesse!

jessemapel commented 3 years ago

The ISIS data area transition continues to be one of the changes I am both very happy about but also constantly fielding bug reports over!

rbeyer commented 3 years ago

Good catch, though.