Skip to content

Commit

Permalink
Merge pull request #284 from callumrollo/callum-patch-93
Browse files Browse the repository at this point in the history
Check that all sensor serial numbers are strings
  • Loading branch information
callumrollo authored Jul 11, 2024
2 parents 8c7e26c + 27af36f commit b7c30bb
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mission_yaml/SEA63_M71.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0040
serial: '0040'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA63_M72.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0040
serial: '0040'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA63_M73.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0040
serial: '0040'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA63_M74.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0040
serial: '0040'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA67_M55.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0041
serial: '0041'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA67_M56.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0041
serial: '0041'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA67_M58.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0041
serial: '0041'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA67_M59.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0041
serial: '0041'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA78_M24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0071
serial: '0071'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion mission_yaml/SEA78_M25.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ glider_devices:
oxygen:
make: JFE Advantech
model: AROD-FT
serial: 0071
serial: '0071'
long_name: JFE Advantech RINKO-FT
make_model: JFE Advantech AROD_FT
factory_calibrated: 'Yes'
Expand Down
9 changes: 8 additions & 1 deletion yaml_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def check_yaml(yaml_path, check_urls=False, log_level='INFO'):
'deployment_name', 'project', 'project_url', 'summary',
'sea_name')


for key in metadata_keys:
if key not in deployment['metadata'].keys():
_log.error(f'{key} not found in metadata')
Expand Down Expand Up @@ -88,6 +87,7 @@ def check_yaml(yaml_path, check_urls=False, log_level='INFO'):
check_keep_variables(deployment, _log)
check_variables(deployment['netcdf_variables'], _log)
check_qc(deployment, _log)
check_sensor_serials(deployment['glider_devices'], _log)


def check_qc(deployment, _log):
Expand Down Expand Up @@ -175,6 +175,13 @@ def check_variables(variables, _log):
if var["average_method"] != "geometric mean":
_log.error(f"{name} avergage_method should be 'geometric mean'")


def check_sensor_serials(sensors, _log):
for sensor, attrs in sensors.items():
if type(attrs['serial']) is not str:
_log.error(f"type of {sensor} serial number must be a string. It is {type(attrs['serial'])}")


if __name__ == '__main__':
args = sys.argv
url_check = False
Expand Down

0 comments on commit b7c30bb

Please sign in to comment.