I have existing code that uses coda that has ran in the past. Now it fails to run. Is there any reason why I can’t use dict to convert the record attributes to a dictionary?
$ ipython3
Python 3.8.7 (default, Jan 20 2021, 00:00:00)
In [1]: import coda
...: f='GOME_xxx_1B_M01_20200621053556Z_20200621053856Z_N_O_20200621062010Z'
...: fh = coda.open(f)
...: Record = coda.fetch(fh, 'MPHR')
...: Record.__dict__
...: fh.close()
...:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-1-ca789494d98a> in <module>
3 fh = coda.open(f)
4 Record = coda.fetch(fh, 'MPHR')
----> 5 Record.__dict__
6 fh.close()
/usr/local/free/installed/coda-2.22-fc32/lib64/python3.8/site-packages/coda/__init__.py in __getattr__(self, field)
2711
2712 def __getattr__(self, field):
-> 2713 return self._values[self._field_to_index[field]]
2714
2715 def __setattr__(self, field, value):
KeyError: '__dict__'
In [2]: print (Record)
RECORD_HEADER:record (7 fields)
PRODUCT_NAME:"GOME_xxx_1B_M01_20200621053556Z_20200621053856Z_N_O_20200621062010Z"
PARENT_PRODUCT_NAME_1:"GOME_xxx_1A_M01_20200621053556Z_20200621053856Z_N_O_20200621061959Z"
PARENT_PRODUCT_NAME_2:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
PARENT_PRODUCT_NAME_3:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
PARENT_PRODUCT_NAME_4:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
INSTRUMENT_ID:"GOME"
INSTRUMENT_MODEL:" 1"
PRODUCT_TYPE:"xxx"
PROCESSING_LEVEL:"1B"
SPACECRAFT_ID:"M01"
SENSING_START:646032956.0
SENSING_END:646033136.0
SENSING_START_THEORETICAL:646032600.0
SENSING_END_THEORETICAL:646038720.0
PROCESSING_CENTRE:"CGS1"
PROCESSOR_MAJOR_VERSION:6
PROCESSOR_MINOR_VERSION:3
FORMAT_MAJOR_VERSION:12
FORMAT_MINOR_VERSION:0
PROCESSING_TIME_START:646035610.0
PROCESSING_TIME_END:646035633.0
PROCESSING_MODE:b'N'
DISPOSITION_MODE:b'O'
RECEIVING_GROUND_STATION:"SVL"
RECEIVE_TIME_START:646035305.0
RECEIVE_TIME_END:646035321.0
ORBIT_START:40256
ORBIT_END:40257
ACTUAL_PRODUCT_SIZE:47739883
STATE_VECTOR_TIME:646030700.0
SEMI_MAJOR_AXIS:7204543025
ECCENTRICITY:0.001283
INCLINATION:98.684
PERIGEE_ARGUMENT:64.733
RIGHT_ASCENSION:232.454
MEAN_ANOMALY:295.324
X_POSITION:-2693904.82
Y_POSITION:-6677680.734
Z_POSITION:-9436.418
X_VELOCTIY:-1529.334
Y_VELOCTIY:615.877
Z_VELOCTIY:7356.927
EARTH_SUN_DISTANCE_RATIO:1016332
LOCATION_TOLERANCE_RADIAL:0
LOCATION_TOLERANCE_CROSSTRACK:0
LOCATION_TOLERANCE_ALONGTRACK:0
YAW_ERROR:0.0
ROLL_ERROR:0.0
PITCH_ERROR:0.0
SUBSAT_LATITUDE_START:45.779
SUBSAT_LONGITUDE_START:67.604
SUBSAT_LATITUDE_END:35.314
SUBSAT_LONGITUDE_END:64.049
LEAP_SECOND:0
LEAP_SECOND_UTC:nan
TOTAL_RECORDS:55
TOTAL_MPHR:1
TOTAL_SPHR:1
TOTAL_IPR:12
TOTAL_GEADR:3
TOTAL_GIADR:4
TOTAL_VEADR:3
TOTAL_VIADR:1
TOTAL_MDR:30
COUNT_DEGRADED_INST_MDR:0
COUNT_DEGRADED_PROC_MDR:0
COUNT_DEGRADED_INST_MDR_BLOCKS:0
COUNT_DEGRADED_PROC_MDR_BLOCKS:0
DURATION_OF_PRODUCT:179999
MILLISECONDS_OF_DATA_PRESENT:179999
MILLISECONDS_OF_DATA_MISSING:0
SUBSETTED_PRODUCT:"F"