This is a little tricky to debug. Trying to write emtfxml, and encountered some issues.
self.site.acquired_by = sm.acquired_by.author
try:
self.sub_type = f"{sm.data_type.upper()}_TF"
except AttributeError:
#self.sub_type = "LPMT_TF"
# self.sub_type = "LPMT"
# mt_metadata.utils.exceptions.MTSchemaError: LPMT_TF not found in
# options list ['MT_TF']
self.sub_type = "MT_TF"
for r in sm.run_list:
fn = emtf_xml.FieldNotes()
fn.dipole = []
fn.magnetometer = []
try:
fn.instrument.id = r.data_logger.id
fn.instrument.name = r.data_logger.type
fn.instrument.manufacturer = r.data_logger.manufacturer
fn.sampling_rate = r.sample_rate
fn.start = r.time_period.start
fn.end = r.time_period.end
except AttributeError:
fn.instrument.id = "GMD"
fn.instrument.name = "gus the magic datalogger"
fn.instrument.manufacturer = "Louis XIV"
fn.sampling_rate = 1.0
fn.start = "2020-05-03T12:12:12+00:00"
#"1980-01-01T00:00:00+00:00"
fn.end = "2020-05-04T12:12:12+00:00"
if required:
if (
value not in [None, "1980-01-01T00:00:00+00:00"]
or self._attr_dict[name]["required"]
):
print(f"name {name}")
if name=="value":
print("??")
print(f"value {value}")
meta_dict[name] = value
else:
meta_dict[name] = value
...
name location.z2
value 0.0
name location.declination.model
value None
name location.declination.epoch
value None
name location.declination.value
value None
name orientation.method
value None
name orientation.reference_frame
value geographic
name orientation.angle_to_geographic_north
value 0.0
name value
??
value 0
Traceback (most recent call last):
File "test_process_cas04.py", line 77, in <module>
main()
File "test_process_cas04.py", line 71, in main
process_cas04()
File "test_process_cas04.py", line 14, in process_cas04
tf_cls.write_tf_file(fn="test_emtf.xml", file_type="emtfxml")
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/transfer_functions/core.py", line 962, in write_tf_file
return write_file(self, fn, file_type=file_type)
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/transfer_functions/io/readwrite.py", line 195, in write_file
return file_writer(mt_object, fn)
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/transfer_functions/io/emtfxml.py", line 1066, in write_emtfxml
emtf.write(fn=fn)
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/transfer_functions/io/emtfxml.py", line 272, in write
emtf_element, value,
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/transfer_functions/io/emtfxml.py", line 401, in _write_element
parent.append(self._convert_tag_to_capwords(value.to_xml()))
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 744, in to_xml
self.to_dict(nested=True, required=required), self._attr_dict
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 597, in to_dict
value not in [None, "1980-01-01T00:00:00+00:00"]
File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 76, in __eq__
sorted(json.loads(other).items(), key=itemgetter(0))
File "/home/kkappler/anaconda2/envs/py37/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/home/kkappler/anaconda2/envs/py37/lib/python3.7/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)
Look at the output .. normally it is showing key-value pairs, but right before it fails the name of the key is "value" which is weird.
In any case, what seems to be happening is that some metadata element is failing when it calls
but I cannot seem to track down the offending piece of metadata. FWIW I got the same result on IAK34 and CAS04