Commit 4d5392fd authored by cponcele's avatar cponcele
Browse files

PR to allow only two types of time unit

parent b1a0c544
......@@ -161,6 +161,11 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -358,7 +363,7 @@
{
"name": "units",
"value": "degree_Celsius"
},
},
{
"name": "long_name",
"value": "Sea water temperature, For a Sound velocity profile"
......@@ -457,6 +462,11 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -723,6 +733,10 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -774,8 +788,13 @@
"name": "standard_name",
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -864,8 +883,14 @@
"name": "standard_name",
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -889,7 +914,7 @@
"attributes": [],
"variables": [],
"coordinatevariables": [],
"subGroups": [
"subGroups": [
]
}
]
......@@ -946,8 +971,13 @@
"name": "standard_name",
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -1001,8 +1031,13 @@
"name": "standard_name",
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -1042,6 +1077,10 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -1174,6 +1213,10 @@
},
{
"name": "standard_name",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "time"
},
{
......@@ -1376,6 +1419,10 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -1582,6 +1629,10 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -1660,6 +1711,10 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......
......@@ -871,7 +871,13 @@
},
{
"name": "units",
"value": "nanoseconds since 1601-01-01 00:00:00Z"
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
"name": "coordinates",
......@@ -881,6 +887,81 @@
}
],
"subGroups": [
{
"name": "NMEA",
"dims": [
{
"name": "time",
"comment": "Can be fixed or unlimited length, as appropriate."
}
],
"types": [],
"attributes": [
{
"name": "description",
"obligation": "M",
"value": "All NMEA sensor datagrams",
"comment": "Description of the subgroup contents."
}
],
"variables": [
{
"name": "NMEA_datagram",
"dims": [
"time"
],
"type": "string",
"obligation": "O",
"comment": "Example of how to store NMEA datagrams.",
"attributes": [
{
"name": "long_name",
"value": "NMEA datagram"
}
]
}
],
"coordinatevariables": [{
"name": "time",
"obligation": "M",
"dims": [
"time"
],
"type": "uint64",
"attributes": [
{
"name": "axis",
"value": "T"
},
{
"name": "calendar",
"value": "gregorian"
},
{
"name": "long_name",
"value": "Timestamps for NMEA datagrams"
},
{
"name": "standard_name",
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
}
]
}],
"subGroups": []
},
{
"name": "Vendor_specific",
"dims": [],
......@@ -1395,12 +1476,17 @@
"value": "Timestamps for attitude data"
},
{
"name": "standard_name",
"name": "standard_name",
"value": "time"
},
{
"name": "units",
"value": "nanoseconds since 1601-01-01 00:00:00Z"
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
}
]
}
......@@ -1484,7 +1570,13 @@
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -1525,7 +1617,7 @@
}
]
},
{
"name": "dgm_version",
"dims": [
......@@ -1947,7 +2039,13 @@
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -2025,7 +2123,13 @@
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -2231,7 +2335,7 @@
],
"types": [],
"attributes": [],
"variables": [
"variables": [
{
"name": "time",
"comment": "Timestamp at which each ping occurred. ",
......@@ -2250,6 +2354,11 @@
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -2936,7 +3045,13 @@
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -3055,7 +3170,13 @@
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -3169,7 +3290,7 @@
"type": "String",
"attributes": []
},
{
{
"name": "s7k_software_version",
"dims": [
"installation"
......
......@@ -1569,7 +1569,52 @@
},
{
"name": "units",
"value": "nanoseconds since 1601-01-01 00:00:00Z"
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
"name": "coordinates",
"value": "ping_time platform_latitude platform_longitude"
}
]
},
{
"name": "mean_time",
"obligation": "M",
"comment": "Timestamp for the center of an averaging period.",
"dims": [
"ping_time"
],
"type": "uint64",
"attributes": [
{
"name": "axis",
"value": "T"
},
{
"name": "calendar",
"value": "gregorian"
},
{
"name": "long_name",
"value": "Time-stamp for the center of each averaged value"
},
{
"name": "standard_name",
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
"name": "coordinates",
......@@ -3080,7 +3125,7 @@
}
]
},
{
{
"name": "effectiveSignalLength_sec",
"dims": [
"ping_time",
......@@ -3714,7 +3759,13 @@
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -4401,7 +4452,13 @@
"value": "time"
},
{
"name": "units",
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
......@@ -6547,19 +6604,20 @@
"comment": "Number of cells in range dimension."
}
],
"types": [
{
"name": "byte enum backscatter_type_t {Sv = 0, Sa = 1}",
"comment": "In what form is the acoustic data stored? Controlled vocabulary options include : Sv, Volume backscattering strength (dB re 1 m-1) and Sa, Nautical area scattering coefficient (m2 nmi-2)."
},
{
"name": "byte enum range_axis_interval_type_t {Range = 0, Depth = 1}",
"comment": "Range axis interval by which data have been regridded. Controlled vocabulary includes: Range (metres), Depth relative to waterline (metres)."
}, {
"name": "byte enum ping_axis_interval_type_t {Time_seconds = 0, Distance_nautical_miles = 1, Distance_meters = 2, Number_of_ping = 3}",
"comment": " Ping axis interval by which data have been regridded. Controlled vocabulary includes: Time based intervals ( Time (seconds) ), Distance based intervals ( Distance (nautical miles); Distance (metres) ), Ping based intervals (Number of pings)."
}
],
"types": [
{
"name": "byte enum backscatter_type_t {Sv = 0, Sa = 1}",
"comment": "In what form is the acoustic data stored? Controlled vocabulary options include : Sv, Volume backscattering strength (dB re 1 m-1) and Sa, Nautical area scattering coefficient (m2 nmi-2)."
},
{
"name": "byte enum range_axis_interval_type_t {Range = 0, Depth = 1}",
"comment": "Range axis interval by which data have been regridded. Controlled vocabulary includes: Range (metres), Depth relative to waterline (metres)."
},
{
"name": "byte enum ping_axis_interval_type_t {Time_seconds = 0, Distance_nautical_miles = 1, Distance_meters = 2, Number_of_ping = 3}",
"comment": " Ping axis interval by which data have been regridded. Controlled vocabulary includes: Time based intervals ( Time (seconds) ), Distance based intervals ( Distance (nautical miles); Distance (metres) ), Ping based intervals (Number of pings)."
}
],
"attributes": [
{
"name": "beam_mode",
......@@ -6673,7 +6731,7 @@
]
},
{
{
"name": "range_axis_interval_type",
"obligation": "M",
"comment": "Reference for regridding the data in range or depth axis.",
......@@ -6707,7 +6765,8 @@
"obligation": "M",
"comment": "Mean timestamp of the pings contributing to the cell.",
"dims": [
"ping_axis","tx_beam"
"ping_axis",
"tx_beam"
],
"type": "uint64",
"attributes": [
......@@ -6728,8 +6787,15 @@
"value": "time"
},
{
"name": "units",
"value": "nanoseconds since 1601-01-01 00:00:00Z"
"values": [
"nanoseconds since 1970-01-01 00:00:00Z",
"nanoseconds since 1601-01-01 00:00:00Z"
],
"value": "nanoseconds since 1970-01-01 00:00:00Z"
},
{
"name": "coordinates",
......@@ -7090,7 +7156,7 @@
"name": "beam_type",
"obligation": "M",
"comment": "Type of split-aperture beam (or not).",
"dims": ["beam"],
"dims": [ "beam" ],
"type": "beam_t",
"attributes": [
{
......@@ -7213,7 +7279,8 @@
"obligation": "M",
"comment": "Time between individual samples along a beam. Common for all beams in a ping.",
"dims": [
"ping_axis","beam"
"ping_axis",
"beam"
],
"type": "float",
"attributes": [
......
......@@ -4,6 +4,7 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import fr.ifremer.fr.xsf.generator.model.Attribute;
......@@ -218,6 +219,8 @@ public class AsciiDoctorGenerator {
return;
reallyWriteVariable("Variables", variables, context);
}
private void writeVariableAttributes( List<Attribute> attributes, Context context) throws IOException {
for(Attribute v:attributes)
{
......@@ -229,7 +232,18 @@ public class AsciiDoctorGenerator {
//assume a string type
if(v.getType()==null|| v.getType().compareToIgnoreCase("string")==0)
{
if(v.getValue()!=null)
if (v.getValues()!=null && v.getValues().length>0)
{
//we generate doc values by writing each possibility with a "or" between them
StringBuilder b=new StringBuilder();
value+="\u00A0=\u00A0";
ArrayList<String> valueList=new ArrayList<>();
for (String subv:v.getValues())
valueList.add("\""+subv+"\"");
value+=String.join(" or ",valueList);
} else if(v.getValue()!=null)
{
//on utilise des espace insécables pour se conformer à la doc WCFAST
value+="\u00A0=\u00A0\"";
......
......@@ -3,8 +3,9 @@ package fr.ifremer.fr.xsf.generator.model;
public class Attribute extends Base{
final String value;
private final String type;
final String[] values;
public Attribute(String name, String description, String comment, String obligation, String value, String type) {
public Attribute(String name, String description, String comment, String obligation, String value, String type,String[] values) {
super(name, description, comment, obligation);
if(value==null || value.trim().isEmpty())
this.value=null;
......@@ -18,6 +19,14 @@ public class Attribute extends Base{
this.type = type;
}
if(values==null || values.length==0)
this.values=null;
else
this.values=values;
}
public String[] getValues() {
return values;
}
public String getValue() {
......
......@@ -15,6 +15,7 @@ public class GAttributeAdapter implements JsonSerializer<Attribute> {
GBaseAdapter.serialize(object, value, context);
object.add("value", context.serialize(value.getValue()));
object.add("type", context.serialize(value.getType()));
object.add("values", context.serialize(value.getValues()));