ImperialCollegeLondon / safedata_validator

Python tools to validate and publish datasets using the safedata metadata format.
https://safedata-validator.readthedocs.io/
MIT License
2 stars 4 forks source link

Extent update fails if all entries invalid #87

Closed davidorme closed 9 months ago

davidorme commented 9 months ago

The spatial and temporal extents are updated when validating fields containing temporal or spatial data. If all the entries in that field are invalid (NA or not formatted correctly) then the code tries to take min and max of nothing and throws an error:

  File "/Users/dorme/Research/SAFE/Database/safedata_validator_package/safedata_validator/field.py", line 2104, in validate_data
    self.min = min(data)
jacobcook1995 commented 9 months ago

I don't think I made an issue for this but I believe that this issue is fixed by #83

jacobcook1995 commented 9 months ago

The fix only exists on the release/3.0.0 branch, not on the develop branch

davidorme commented 9 months ago

Aha - I'm running on feature/docs_update. Might that branch predate #83?

jacobcook1995 commented 9 months ago

The PR for the docs update is #79, so I think so

davidorme commented 9 months ago

OK - excellent. It looks like GeoField already handles this case but doesn't test the implementation, so I'll add a test for this and fix that.

davidorme commented 9 months ago

There's actually a downstream bug of this - DatetimeField.report fails if all data are invalid because it tries to take the .date property of None. Will fix.