Commit 33467969 authored by PONCELET's avatar PONCELET

Update source code generator for adaption with model evolution

parent c5236f7f
......@@ -1494,7 +1494,7 @@
},
{
"name": "valid_range",
"value": "0.0, 360.0",
"value": "0.0f, 360.0f",
"type": "float"
}
]
......@@ -1599,7 +1599,7 @@
},
{
"name": "valid_range",
"value": "-90.0, 90.0",
"value": "-90.0f, 90.0f",
"type": "float"
}
]
......@@ -1842,7 +1842,7 @@
},
{
"name": "tx_beam",
"comment": "The number of tx_beams in this beam group"
"comment": "The number of transmit beams in this beam group"
},
{
"name": "backscatter_sample",
......@@ -1870,7 +1870,7 @@
"obligation": "M",
"comment": "Timestamp at which each ping occurred.",
"dims": [
"ping_time"
"ping_timeDim"
],
"type": "uint64",
"attributes": [
......@@ -1936,8 +1936,8 @@
"obligation": "MA",
"comment": "Imaginary part of backscatter measurements. Each element in the 2D matrix is a variable length vector (of type sample_t) that contains the samples for that beam and ping time.",
"dims": [
"ping_time",
"beam"
"ping_timeDim",
"beamDim"
],
"type": "sample_byte_t",
"attributes": [
......@@ -2157,6 +2157,159 @@
}
]
},
{
"name": "tx_beam_direction_x",
"obligation": "M",
"comment": "The _x_-axis coordinate of a unit vector in the tx_beam direction for each beam and ping in the FACS coordinate system (ie relative to the vertical)",
"dims": [
"ping_timeDim",
"beamDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "_x_-component of the vector that gives the pointing direction of the tx_beam, in sonar beam coordinate system"
},
{
"name": "crs",
"value": "FACS"
},
{
"name": "valid_range",
"value": "-1.0f, 1.0f",
"type": "float"
}
]
},
{
"name": "tx_beam_direction_y",
"obligation": "M",
"comment": "The _y_-axis coordinate of a unit vector in the beam direction for each tx_beam and ping, in the FACS coordinate system (ie relative to the vertical)",
"dims": [
"ping_timeDim",
"beamDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "_y_-component of the vector that gives the pointing direction of the tx_beam, in the FACS coordinate system (ie relative to the vertical)"
},
{
"name": "valid_range",
"value": "-1.0f, 1.0f",
"type": "float"
},
{
"name": "crs",
"value": "FACS"
}
]
},
{
"name": "tx_beam_direction_z",
"obligation": "M",
"comment": "The _z_-axis coordinate of a unit vector in the tx_beam direction for each beam and ping, in the FACS coordinate system (ie relative to the vertical)",
"dims": [
"ping_timeDim",
"beamDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "_z_-component of the vector that gives the pointing direction of the tx_beam, in the FACS coordinate system (ie relative to the vertical)"
},
{
"name": "valid_range",
"value": "-1.0f, 1.0f",
"type": "float"
},
{
"name": "crs",
"value": "FACS"
}
]
},
{
"name": "tx_tilt_angle",
"obligation": "M",
"comment": "the along ship steering angle of beam relative the transducer face in TACS coordinate system",
"dims": [
"ping_timeDim",
"tx_beamDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "the along ship steering angle of beam relative the transducer face in TACS coordinate system"
},
{
"name": "crs",
"value": "TACS"
},
{
"name": "valid_range",
"value": "-90.0f, 90.0f",
"type": "float"
},
{
"name": "units",
"value": "arc_degree"
}
]
},
{
"name": "tx_transducer_zdepth",
"obligation": "O",
"comment": "Tx transducer depth in meters below waterline, at time of midpoint of first tx pulse. For the tx array (head) used by this RX-fan. Use depth of TX1 to move depth point (XYZ) from water line to transducer (reference point of old datagram format). ",
"dims": [
"ping_timeDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "Tx transducer depth below waterline"
},
{
"name": "units",
"value": "m"
}
]
},
{
"name": "beam_stabilisation",
"obligation": "M",
"comment": "Indicates whether or not sonar beams have been compensated for platform motion.",
"dims": [
"ping_timeDim"
],
"type": "beam_stabilisation_t",
"attributes": [
{
"name": "long_name",
"value": "Beam stabilisation applied (or not)"
}
]
},
{
"name": "beam_type",
"obligation": "M",
"comment": "Type of beam.",
"dims": [
"ping_timeDim"
],
"type": "beam_t",
"attributes": [
{
"name": "long_name",
"value": "Type of beam"
}
]
},
{
"name": "equivalent_beam_angle",
"obligation": "M",
......@@ -2274,7 +2427,26 @@
{
"name": "sample_time_offset",
"obligation": "M",
"comment": "Time offset applied to sample time-stamps and intended for applying a range correction (e.g. as caused by signal processing delays). Positive values reduce the calculated range to a sample. For multibeam echo sounder, this match the transmit sector time delay",
"comment": "Time offset applied to sample time-stamps and intended for applying a range correction (e.g. as caused by signal processing delays). Positive values reduce the calculated range to a sample.",
"dims": [
"ping_timeDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "Time offset that is subtracted from the timestamp of each sample"
},
{
"name": "units",
"value": "s"
}
]
},
{
"name": "transmit_time_delay",
"obligation": "O",
"comment": "Time delay for each transmit beam between the ping time and the transmit time",
"dims": [
"ping_timeDim",
"tx_beamDim"
......@@ -2283,7 +2455,7 @@
"attributes": [
{
"name": "long_name",
"value": "Time offset that is subtracted from the timestamp of each sample (For multibeam echo sounder, this match the transmit sector time delay)"
"value": "Time delay for each transmit beam between the ping time and the transmit time"
},
{
"name": "units",
......@@ -2292,22 +2464,26 @@
]
},
{
"name": "sample_start_offset",
"name": "blanking_interval",
"obligation": "M",
"comment": "number of sample before the start of sample recording, this amount of empty sample should be added to the water column data",
"comment": "Time between first sample in data array and the first valid values.",
"dims": [
"ping_timeDim",
"beamDim"
],
"type": "int",
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "number of sample before the start of sample recording"
"value": "Time between first recorded sample in data array and the first valid value "
},
{
"name": "units",
"value": "s"
},
{
"name": "valid_min",
"value": "0"
"value": "0.0"
}
]
},
......@@ -2355,7 +2531,8 @@
"obligation": "O",
"comment": "Estimated bandwidth of the transmitted pulse. For CW pulses, this is a function of the pulse duration and frequency. For FM pulses, this will be close to the difference between transmit_frequency_start and transmit_frequency_stop.",
"dims": [
"ping_timeDim"
"ping_timeDim",
"tx_beamDim"
],
"type": "float",
"attributes": [
......@@ -2379,7 +2556,8 @@
"obligation": "MA",
"comment": "Equivalent duration of the transmit pulse. This is the square pulse containing the same energy as the actual transmitted pulse. Necessary for both type 1 and 2 conversion equations.",
"dims": [
"ping_timeDim"
"ping_timeDim",
"tx_beamDim"
],
"type": "float",
"attributes": [
......@@ -2403,7 +2581,8 @@
"obligation": "M",
"comment": "Nominal duration of the transmit pulse. This is not the equivalent pulse duration.",
"dims": [
"ping_timeDim"
"ping_timeDim",
"tx_beamDim"
],
"type": "float",
"attributes": [
......@@ -2428,7 +2607,7 @@
"comment": "Frequency at the start of the transmit pulse. The beam dimension can be omitted, in which case the value apples to all beams in the ping.",
"dims": [
"ping_timeDim",
"beamDim"
"tx_beamDim"
],
"type": "float",
"attributes": [
......@@ -2457,7 +2636,7 @@
"comment": "Frequency at the end of the transmit pulse. The beam dimension can be omitted, in which case the value apples to all beams in the ping.",
"dims": [
"ping_timeDim",
"beamDim"
"tx_beamDim"
],
"type": "float",
"attributes": [
......@@ -2613,7 +2792,34 @@
}
]
},
{
"name": "sound_speed_at_transducer",
"obligation": "O",
"comment": "Sound speed at tx transducer depth at ping time",
"dims": [
"ping_timeDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "Indicative sound speed at ping time and transducer depth"
},
{
"name": "units",
"value": "m/s"
},
{
"name": "valid_min",
"value": "0.0",
"type": "float"
},
{
"name": "standard_name",
"value": "speed_of_sound_in_sea_water"
}
]
},
{
"name": "platform_latitude",
"obligation": "M",
......@@ -2693,7 +2899,7 @@
},
{
"name": "valid_range",
"value": "0, 360.0",
"value": "0f, 360.0f",
"type": "float"
}
]
......@@ -2725,7 +2931,7 @@
},
{
"name": "valid_range",
"value": "−90.0, 90.0",
"value": "-90.0f, 90.0f",
"type": "float"
}
]
......@@ -2790,34 +2996,7 @@
}
]
},
{
"name": "sound_speed_at_transducer",
"obligation": "O",
"comment": "Sound speed at tx transducer depth at the mid-time of emission of the first tx pulse",
"dims": [
"ping_timeDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "Indicative sound speed at tx time and depth"
},
{
"name": "units",
"value": "m/s"
},
{
"name": "valid_min",
"value": "0.0",
"type": "float"
},
{
"name": "standard_name",
"value": "speed_of_sound_in_sea_water"
}
]
},
{
"name": "swath_dynamic_draught",
"obligation": "M",
......@@ -2887,74 +3066,7 @@
}
]
},
{
"name": "tx_center_frequency",
"obligation": "M",
"comment": "center frequency of transmit sector",
"dims": [
"ping_timeDim",
"tx_beamDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "center frequency of transmit sector"
},
{
"name": "units",
"value": "Hz"
}
]
},
{
"name": "tx_tilt_angle",
"obligation": "M",
"comment": "the along ship steering angle of beam relative the transducer face in TACS coordinate system",
"dims": [
"ping_timeDim",
"tx_beamDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "the along ship steering angle of beam relative the transducer face in TACS coordinate system"
},
{
"name": "crs",
"value": "TACS"
},
{
"name": "valid_range",
"value": "-90.0f, 90.0f",
"type": "float"
},
{
"name": "units",
"value": "arc_degree"
}
]
},
{
"name": "tx_transducer_zdepth",
"obligation": "O",
"comment": "Tx transducer depth in meters below waterline, at time of midpoint of first tx pulse. For the tx array (head) used by this RX-fan. Use depth of TX1 to move depth point (XYZ) from water line to transducer (reference point of old datagram format). ",
"dims": [
"ping_timeDim"
],
"type": "float",
"attributes": [
{
"name": "long_name",
"value": "Tx transducer depth below waterline"
},
{
"name": "units",
"value": "m"
}
]
},
{
"name": "beam_detection_range",
"obligation": "0",
......
......@@ -34,48 +34,73 @@
package fr.ifremer.fr.xsf.generator;
import java.math.BigInteger;
import java.nio.ByteBuffer;
/**
* Type-safe enumeration of data types. Do not change the ordering of these enums, as they are used in protobuf
* messages, only add new ones onto the end.
*
* @author john caron
*/
This class is a mixed from the ones extracted in jna Ncprototypes.java class and netcdf java api DataType.java
*/
////NC_types, from Nc4prototypes
interface Nc4prototypes{
static int NC_NAT = 0; /* Not-A-Type */
static int NC_BYTE = 1; /* signed 1 byte integer */
static int NC_CHAR = 2; /* ISO/ASCII character */
static int NC_SHORT = 3; /* signed 2 byte integer */
static int NC_INT = 4; /* signed 4 byte integer */
static int NC_FLOAT = 5; /* single precision floating point number */
static int NC_DOUBLE = 6; /* double precision floating point number */
static int NC_UBYTE = 7; /* unsigned 1 byte int */
static int NC_USHORT = 8; /* unsigned 2-byte int */
static int NC_UINT = 9; /* unsigned 4-byte int */
static int NC_INT64 = 10; /* signed 8-byte int */
static int NC_UINT64 = 11;/* unsigned 8-byte int */
static int NC_STRING = 12; /* string */
static int NC_MAX_ATOMIC_TYPE = NC_STRING;
/////
}
public enum DataType {
BOOLEAN("boolean", 1, boolean.class, false),
BYTE("byte", 1, byte.class, false),
CHAR("char", 1, char.class,false),
SHORT("short", 2, short.class, false),
INT("int", 4, int.class, false),
BOOLEAN("boolean", 1, boolean.class, false,Nc4prototypes.NC_BYTE),
BYTE("byte", 1, byte.class, false,Nc4prototypes.NC_BYTE),
CHAR("char", 1, char.class,false,Nc4prototypes.NC_CHAR),
SHORT("short", 2, short.class, false,Nc4prototypes.NC_SHORT),
INT("int", 4, int.class, false,Nc4prototypes.NC_INT),
LONG("long", 8, long.class,
false),
FLOAT("float", 4, float.class, false),
DOUBLE("double", 8, double.class, false),
false,Nc4prototypes.NC_INT64),
FLOAT("float", 4, float.class, false,Nc4prototypes.NC_FLOAT),
DOUBLE("double", 8, double.class, false,Nc4prototypes.NC_DOUBLE),
// object types
STRING("String", 4, String.class, false), // 32-bit index
ENUM1("enum1", 1, byte.class, false), // byte
ENUM2("enum2", 2, short.class, false), // short
ENUM4("enum4", 4, int.class, false), // int
OPAQUE("opaque", 1, ByteBuffer.class, false), // byte blobs
OBJECT("object", 1, Object.class, false), // added for use with Array
UBYTE("ubyte", 1, byte.class, true),
USHORT("ushort", 2, short.class, true),
UINT("uint", 4, int.class,true),
ULONG("ulong", 8, long.class, true);
STRING("String", 4, String.class, false,Nc4prototypes.NC_STRING), // 32-bit index
ENUM1("enum1", 1, byte.class, false,Nc4prototypes.NC_BYTE), // byte
ENUM2("enum2", 2, short.class, false,Nc4prototypes.NC_SHORT), // short
ENUM4("enum4", 4, int.class, false,Nc4prototypes.NC_INT), // int
// OPAQUE("opaque", 1, ByteBuffer.class, false), // byte blobs
// OBJECT("object", 1, Object.class, false,), // added for use with Array
UBYTE("ubyte", 1, byte.class, true,Nc4prototypes.NC_UBYTE),
USHORT("ushort", 2, short.class, true,Nc4prototypes.NC_USHORT),
UINT("uint", 4, int.class,true,Nc4prototypes.NC_UINT),
ULONG("ulong", 8, long.class, true,Nc4prototypes.NC_UINT64);
private final String niceName;
private final int size;
private final Class<?> primitiveClass;
private final boolean isUnsigned;
private int nc_type;
/**
* Return the native nc_type associated with this enum
* */
public int getNc_type() {
return nc_type;
}
DataType(String s, int size, Class<?> primitiveClass, boolean isUnsigned) {
DataType(String s, int size, Class<?> primitiveClass, boolean isUnsigned,int nc_type) {
this.niceName = s;
this.size = size;
this.primitiveClass = primitiveClass;
this.isUnsigned = isUnsigned;
this.nc_type=nc_type;
}
/**
......@@ -233,9 +258,8 @@ public enum DataType {
return isUnsigned ? DataType.ULONG : DataType.LONG;
if (c == String.class)
return DataType.STRING;
if (c == ByteBuffer.class)
return DataType.OPAQUE;
return DataType.OBJECT;
throw new RuntimeException("Unknown or unsupported type");
}
/**
......@@ -289,6 +313,6 @@ public enum DataType {
return (short) (b & 0xff);
}
}
......@@ -16,6 +16,8 @@ public class DataTypeConverter {
case "TRANSDUCER_TYPE_T":
case "DETECTION_TYPE_T":
case "TRANSMIT_T":
case "BEAM_STABILISATION_T":
case "BEAM_T":
case "BYTE":
return DataType.BYTE;
case "CHAR":
......@@ -32,6 +34,8 @@ public class DataTypeConverter {
return DataType.UINT;
case "LONG":
return DataType.LONG;
case "UINT64":
return DataType.ULONG;
case "ULONG":
return DataType.ULONG;
case "FLOAT":
......@@ -42,19 +46,14 @@ public class DataTypeConverter {
return DataType.BYTE;
default:
}
// type was not found, should be a specific type, as such it shall have been declared earlier
DataType spec=vlen_specific_types.get(value);
if(spec!=