Open CorentinLouis opened 1 year ago
see the function written by @AdamBoudouma to automatically fill the fields object
It should be added in the write_features_to_json function
(line 421), file https://github.com/CorentinLouis/SPACE_labelling_tool/blob/master/spacelabel/models/dataset/__init__.py
from tfcat.validate import JSONSCHEMA_URI
with open(path_tfcat, 'w') as file_json:
json.dump(
{
"type": "FeatureCollection",
"features": [
feature.to_tfcat_dict() for feature in self._features
],
"schema": JSONSCHEMA_URI,
"fields": {
"feature_name": {
"info": "Feature Type",
"datatype": "str",
"ucd": "meta.id",
"values": {
"shortname1?": "Definition of shortname1",
"shortname2?": "Definition of shortname2",
}
}
},
"crs": {
"type": "local",
"properties": {
"name": "Time-Frequency",
"time_coords_id": "unix",
"spectral_coords": {
"type": "frequency",
"unit": self._units['Frequency']
},
"ref_position_id": self._observer
}
}
},
file_json
)
Are missing in the TFCat file the following:
Each "property" name MUST be defined in the Fields Object. 3.3.1. Field Object The Field Object contains the metadata defining one of the "property" included in the Properties Object members of each Feature Object (see Section 3.2.1.). The Field Object is a JSON object.
The Field Object has a member with name "info". The value of this member contain a description of the "field". The Field Object has a member with name "datatype". The value of this member is one of 'int', 'float' 'bool', or 'str' (TBC) The Field Object has a member with name "ucd". The value of this member is a valid UCD (IVOA Unified Content Description). The Field Object may have a member with name "unit". The value of this member is a valid unit, as defined in the VOUnit specification. If "unit" is not applicable, the member should not be present.