Skip to content

Commit

Permalink
Fix monitoring (#76)
Browse files Browse the repository at this point in the history
* attempt to fix monitoring for new bufr2geojson

* update inspect message
  • Loading branch information
maaikelimper authored Dec 12, 2024
1 parent fda5bda commit 5ba199f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
20 changes: 11 additions & 9 deletions src/components/InspectBufrButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@
<v-col cols="5">
<v-list lines="zero">
<v-list-item><b>WIGOS Station Identifier:</b> {{result.wsi}}</v-list-item>
<v-list-item><b>Station name:</b> {{result.name}}</v-list-item>
<v-list-item><b>Station latitude:</b> {{result.latitude}}</v-list-item>
<v-list-item><b>Station longitude:</b> {{result.longitude}}</v-list-item>
<v-list-item><b>Station elevation:</b> {{result.elevation}} (m)</v-list-item>
<v-list-item><b>Barometer height above mean sea level:</b> {{result.barometerHeight}} (m)</v-list-item>
<v-list-item><b>Nominal report time:</b> {{result.resultTime}}</v-list-item>
<v-list-item><b>Nominal report time:</b> {{result.reportTime}}</v-list-item>
</v-list>
<v-card-item>
<LocatorMap :longitude="result.longitude" :latitude="result.latitude"/>
Expand Down Expand Up @@ -138,14 +135,19 @@
// check for errors
if( data.error ){
console.info("bufr2geojson returned the error:", data.error);
result.value.error = data.error;
// check if error starts with 404
if( data.error.startsWith("404") ){
result.value.error = "File no longer available for inspection";
}else{
result.value.error = data.error;
}
}
// we should have a single subset per file but should add a check to make sure that is the case
// assume one file for now, add to ToDo.
// Get location, elevation, WSI and station name from first object
if( data.items ){
result.value.wsi = data.items[0].properties.wigos_station_identifier;
result.value.name = data.items[0].properties.metadata.find( (item) => item.name === "station_or_site_name")?.description ?? "";
// result.value.name = data.items[0].properties.metadata.find( (item) => item.name === "station_or_site_name")?.description ?? "";
result.value.elevation = parseFloat(data.items[0].geometry.coordinates[2]).toFixed(2);
// if result.value.elevation is NaN, set to 'undefined'
if (isNaN(result.value.elevation)) {
Expand All @@ -156,8 +158,8 @@
// result back to a float
result.value.longitude = parseFloat(parseFloat(data.items[0].geometry.coordinates[0]).toFixed(5));
result.value.latitude = parseFloat(parseFloat(data.items[0].geometry.coordinates[1]).toFixed(5));
result.value.resultTime = data.items[0].properties.resultTime;
result.value.barometerHeight = parseFloat(data.items[0].properties.metadata.find( (item) => item.name === "height_of_barometer_above_mean_sea_level")?.value ?? "").toFixed(2);
result.value.reportTime = data.items[0].properties.reportTime;
// result.value.barometerHeight = parseFloat(data.items[0].properties.metadata.find( (item) => item.name === "height_of_barometer_above_mean_sea_level")?.value ?? "").toFixed(2);
// if result.value.barometerHeight is NaN, set to undefined
if (isNaN(result.value.barometerHeight)) {
result.value.barometerHeight = 'undefined';
Expand Down Expand Up @@ -220,7 +222,7 @@
wsi: null,
name: null,
elevation: null,
resultTime: null,
reportTime: null,
items: [],
headers: []
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/monitoring/BarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default defineComponent({
// This method counts the number of messages per minute
// and uses this to produce an [x,y] array that populates the ApexChart
const chartSeries = computed(() => {
console.log("Creating chart data");
// console.log("Creating chart data");
// Count messages per minute and uses this create the chart data
const timestampCounts = {}
Expand Down
4 changes: 2 additions & 2 deletions src/components/monitoring/NotificationDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export default defineComponent({
params = new URLSearchParams({
f: 'json', // Specify the response format as JSON
metadata_id: `${props.datasetID}%`, // Filter by dataset
sortBy: '-datetime', // Sort by time in descending order
sortby: '-datetime', // Sort by time in descending order
datetime: `${props.startDate.toISOString()}/${props.endDate.toISOString()}`, // Filter to date range specified by user
wigos_station_identifier: `${props.wsi}`, // Filter by WSI searched
limit: `${props.limit}`, // Limit number of notifications shown on dashboard
Expand All @@ -264,7 +264,7 @@ export default defineComponent({
params = new URLSearchParams({
f: 'json', // Specify the response format as JSON
metadata_id: `${props.datasetID}%`, // Filter by dataset
sortBy: '-datetime', // Sort by time in descending order
sortby: '-datetime', // Sort by time in descending order
datetime: `${props.startDate.toISOString()}/${props.endDate.toISOString()}`, // Filter to date range specified by user
limit: `${props.limit}`, // Limit number of notifications shown on dashboard
});
Expand Down

0 comments on commit 5ba199f

Please sign in to comment.