Skip to content

Commit

Permalink
Updated csv limits. (#16)
Browse files Browse the repository at this point in the history
* Updated csv limits.

* Fix nulls failing validation.
  • Loading branch information
david-i-berry authored Sep 20, 2023
1 parent d403dce commit b1559bc
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 73 deletions.
133 changes: 62 additions & 71 deletions webapp/public/csv2bufr/csvw_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,306 +6,297 @@
{
"titles": "wsi_series",
"dc:description": "WIGOS identifier series",
"datatype": {"base": "integer"},
"datatype": {"base": "integer", "minimum": 0, "maximum": 0},
"null": "null"
},
{
"titles": "wsi_issuer",
"dc:description": "WIGOS issuer of identifier",
"datatype": {"base": "integer"},
"datatype": {"base": "integer", "minimum": 0, "maximum": 65534},
"null": "null"
},
{
"titles": "wsi_issue_number",
"dc:description": "WIGOS issue number",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": 0, "maximum": 65534}
},
{
"titles": "wsi_local",
"dc:description": "WIGOS local identifier",
"datatype": {"base": "string"}
"datatype": {"base": "string", "maxLength": 16}
},
{
"titles": "wmo_block_number",
"dc:description": "WMO block number",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": 0, "maximum": 99}
},
{
"titles": "wmo_station_number",
"dc:description": "WMO station number",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": 0, "maximum": 999}
},
{
"titles": "station_type",
"dc:description": "Type of observing station, encoding using code table 0 02 001 (set to 0, automatic)",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": 0, "maximum": 3}
},
{
"titles": "year",
"dc:description": "Year (UTC), the time of observation (based on the actual time the barometer is read)",
"datatype": {
"base": "integer",
"minimum": "1900",
"maximum": "2023"
"minimum": 1600,
"maximum": 2200
}
},
{
"titles": "month",
"dc:description": "Month (UTC), the time of observation (based on the actual time the barometer is read)",
"datatype": {
"base": "integer",
"minimum": "1",
"maximum": "12"
"minimum": 1,
"maximum": 12
}
},
{
"titles": "day",
"dc:description": "Day (UTC), the time of observation (based on the actual time the barometer is read)",
"datatype": {
"base": "integer",
"minimum": "1",
"maximum": "31"
"minimum": 1,
"maximum": 31
}
},
{
"titles": "hour",
"dc:description": "Hour (UTC), the time of observation (based on the actual time the barometer is read)",
"datatype": {
"base": "integer",
"minimum": "0",
"maximum": "23"
"minimum": 0,
"maximum": 23
}
},
{
"titles": "minute",
"dc:description": "Minute (UTC), the time of observation (based on the actual time the barometer is read)",
"datatype": {
"base": "integer",
"minimum": "0",
"maximum": "59"
"minimum": 0,
"maximum": 59
}
},
{
"titles": "latitude",
"dc:description": "Latitude of the station (to 5 decimal places)",
"datatype": {
"base": "decimal",
"minimum": "-90",
"maximum": "90"
"minimum": -90,
"maximum": 90
}
},
{
"titles": "longitude",
"dc:description": "Longitude of the station (to 5 decimal places)",
"datatype": {
"base": "decimal",
"minimum": "-180",
"maximum": "180"
"minimum": -180,
"maximum": 180
}
},
{
"titles": "station_height_above_msl",
"dc:description": "Height of the station ground above mean sea level (to 1 decimal place)",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": -500, "maximum": 9000}
},
{
"titles": "barometer_height_above_msl",
"dc:description": "Height of the barometer above mean sea level (to 1 decimal place), typically height of station ground plus the height of the sensor above local ground",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": -500, "maximum": 9000}
},
{
"titles": "station_pressure",
"dc:description": "Pressure observed at the station level to the nearest 10 pascals",
"datatype": {
"base": "integer",
"minimum": "50000",
"maximum": "150000"
}
"datatype": {"base": "integer", "minimum": 50000, "maximum": 150000}
},
{
"titles": "msl_pressure",
"dc:description": "Pressure reduced to mean sea level to the nearest 10 pascals",
"datatype": {
"base": "integer",
"minimum": "50000",
"maximum": "150000"
}
"datatype": {"base": "integer", "minimum": 50000, "maximum": 150000}
},
{
"titles": "geopotential_height",
"dc:description": "Geoptential height expressed in geopotential meters (gpm) to 0 decimal places",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": -4000, "maximum": 1306710}
},
{
"titles": "thermometer_height",
"dc:description": "Height of thermometer or temperature sensor above the local ground to 2 decimal places",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": 0, "maximum": 655.35}
},
{
"titles": "air_temperature",
"dc:description": "Instantaneous air temperature to 2 decimal places",
"datatype": {
"base": "decimal",
"minimum": "0"
"base": "decimal", "minimum": 193.15, "maximum": 333.15
}
},
{
"titles": "dewpoint_temperature",
"dc:description": "Instantaneous dewpoint temperature to 2 decimal places",
"datatype": {
"base": "decimal",
"minimum": "0"
"base": "decimal", "minimum": 193.15, "maximum": 308.15
}
},
{
"titles": "relative_humidity",
"dc:description": "Instantaneous relative humidity to zero decimal places",
"datatype": {
"base": "integer",
"minimum": "0",
"maximum": "150"
"minimum": 0,
"maximum": 150
}
},
{
"titles": "method_of_ground_state_measurement",
"dc:description": "Method of observing the state of the ground, encoded using code table 0 02 176",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": 0, "maximum": 15}
},
{
"titles": "ground_state",
"dc:description": "State of the ground encoded using code table 0 20 062",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": 0, "maximum": 31}
},
{
"titles": "method_of_snow_depth_measurement",
"dc:description": "Method of observing the snow depth encoded using code table 0 02 177",
"datatype": {"base": "integer"}
"datatype": {"base": "integer", "minimum": 0, "maximum": 15}
},
{
"titles": "snow_depth",
"dc:description": "Snow depth at time of observation to 2 decimal places",
"datatype": {
"base": "decimal",
"minimum": "0"
"base": "decimal", "minimum": -0.02, "maximum": 655.33
}
},
{
"titles": "precipitation_intensity",
"dc:description": "Intensity of precipitation at time of observation to 5 decimal places",
"datatype": {
"base": "decimal",
"minimum": "0"
"base": "decimal", "minimum": -0.00001, "maximum": 0.65534
}
},
{
"titles": "anemometer_height",
"dc:description": "Height of the anemometer above local ground to 2 decimal place",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": 0, "maximum": 655.35}
},
{
"titles": "time_period_of_wind",
"dc:description": "Time period over which the wind speed and direction have been averaged. 10 minutes in normal cases or the number of minutes since a significant change occuring in the preceeding 10 minutes.",
"datatype": {"base": "negativeInteger"}
"dc:description": "Time period over which the wind speed and direction have been averaged. 10 minutes in normal cases or the number of minutes since a significant change occurring in the preceding 10 minutes.",
"datatype": {"base": "integer", "minimum": -10, "maximum": 0}
},
{
"titles": "wind_direction",
"dc:description": "Wind direction (at anemometer height) averaged from the caterisan components over the indicated time period, 0 decimal places",
"dc:description": "Wind direction (at anemometer height) averaged from the cartesian components over the indicated time period, 0 decimal places",
"datatype": {
"base": "integer",
"minimum": "0",
"maximum": "360"
"base": "integer", "minimum": 0, "maximum": 360
}
},
{
"titles": "wind_speed",
"dc:description": "Wind speed (at anemometer height) averaged from the cartesian components over the indicated time period, 1 decimal place",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": 0, "maximum": 409.5}
},
{
"titles": "maximum_wind_gust_direction_10_minutes",
"dc:description": "Highest 3 second average over the preceding 10 minutes, 0 decimal places",
"datatype": {
"base": "integer",
"minimum": "0",
"maximum": "360"
"minimum": 0,
"maximum": 360
}
},
{
"titles": "maximum_wind_gust_speed_10_minutes",
"dc:description": "Highest 3 second average over the preceding 10 minutes, 1 decimal place",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": 0, "maximum": 409.5}
},
{
"titles": "maximum_wind_gust_direction_1_hour",
"dc:description": "Highest 3 second average over the preceding hour, 0 decimal places",
"datatype": {
"base": "integer",
"minimum": "0",
"maximum": "360"
"minimum": 0,
"maximum": 360
}
},
{
"titles": "maximum_wind_gust_speed_1_hour",
"dc:description": "Highest 3 second average over the preceding hour, 1 decimal place",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": 0, "maximum": 409.5}
},
{
"titles": "maximum_wind_gust_direction_3_hours",
"dc:description": "Highest 3 second average over the preceding 3 hours, 0 decimal places",
"datatype": {
"base": "integer",
"minimum": "0",
"maximum": "360"
"minimum": 0,
"maximum": 360
}
},
{
"titles": "maximum_wind_gust_speed_3_hours",
"dc:description": "Highest 3 second average over the preceding 3 hours, 1 decimal place",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": 0, "maximum": 409.5}
},
{
"titles": "rain_sensor_height",
"dc:description": "Height of the rain gauge above local ground to 2 decimal place",
"datatype": {"base": "decimal"}
"datatype": {"base": "decimal", "minimum": 0, "maximum": 655.35}
},
{
"titles": "total_precipitation_1_hour",
"dc:description": "Total precipitation over the past hour, 1 decimal place",
"datatype": {
"base": "decimal",
"minimum": "0"
"minimum": -0.1,
"maximum": 1638.2
}
},
{
"titles": "total_precipitation_3_hours",
"dc:description": "Total precipitation over the past 3 hours, 1 decimal place",
"datatype": {
"base": "decimal",
"minimum": "0"
"minimum": -0.1,
"maximum": 1638.2
}
},
{
"titles": "total_precipitation_6_hours",
"dc:description": "Total precipitation over the past 6 hours, 1 decimal place",
"datatype": {
"base": "decimal",
"minimum": "0"
"minimum": -0.1,
"maximum": 1638.2
}
},
{
"titles": "total_precipitation_12_hours",
"dc:description": "Total precipitation over the past 12 hours, 1 decimal place",
"datatype": {
"base": "decimal",
"minimum": "0"
"minimum": -0.1,
"maximum": 1638.2
}
},
{
"titles": "total_precipitation_24_hours",
"dc:description": "Total precipitation over the past 24 hours, 1 decimal place",
"datatype": {
"base": "decimal",
"minimum": "0"
"minimum": -0.1,
"maximum": 1638.2
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/CsvToBUFRForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
if( header.dataType.minimum ){
valid_min = header.dataType.minimum
}
if( valid_min && (value < valid_min)){
if( value && valid_min && (value < valid_min)){
msg = "Line " + count + ": Column '" +
key + "' out of range, value (" + value + ") < valid min (" +
valid_min + ")";
Expand All @@ -370,7 +370,7 @@
if( header.dataType.maximum ){
valid_max = header.dataType.maximum
}
if( valid_max && (value > valid_max)){
if( value && valid_max && (value > valid_max)){
msg = "Line " + count + ": Column '" + key +
"' out of range, value (" + value + ") > valid max (" + valid_max + ")";
status = 'error';
Expand Down

0 comments on commit b1559bc

Please sign in to comment.