Skip to content

Commit 184b28a

Browse files
committed
feat: Improve naming convention for piezometric stations and observations (close #34)
feat: Both hydro and piezo stations should use the same property, en_service, to indicate whether the station is in service -(close #33)
1 parent 1c750a6 commit 184b28a

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

jobfile-hydro-observations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ let processData = (options) => {
9595
})
9696
if (dataToSave.length > 0) {
9797
total += dataToSave.length
98-
console.log(dataToSave.length + ' new observations found by task ' + item.id.substring(13) + ' [ '+ stationsInUrl.length+' stns] [total: ' + total + ']')
98+
console.log(dataToSave.length + ' new observations found by task ' + item.id.substring(13) + ' [ '+ stationsInUrl.length+' stations] [total: ' + total + ']')
9999
}
100100
item.data = dataToSave
101101

jobfile-piezo-observations.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ let processData = (options) => {
7171
time: timeObs.toISOString(),
7272
geometry: station.geometry,
7373
properties: {
74+
name: station.name,
75+
en_service: true,
7476
bss_id: obs.bss_id,
7577
profondeur_nappe: obs.profondeur_nappe,
7678
niveau_eau_ngf : obs.niveau_eau_ngf
@@ -178,6 +180,7 @@ export default {
178180
// console.log(station.geometry.type)
179181
dictstations[station.properties.bss_id] = {
180182
geometry: {type :station.geometry.type, coordinates: station.geometry.coordinates},
183+
name: station.properties.name,
181184
// last obs is the 00:00:00 of the day before the actual time
182185
last_obs: new Date(actualTime - actualTime % (HISTORY) - (HISTORY)).toISOString()}
183186
})

jobfile-piezo-stations.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,18 @@ export default {
7070
_.forEach(item.data.features, (feature) => {
7171
// We only keep the stations with a geometry and that have a `date_fin_mesure` after 2022-01-01 (older stations are not updated anymore)
7272
if (!feature.geometry) console.log('Warning: station '+feature.properties.bss_id+' has no geometry')
73-
else{
74-
75-
if (new Date(feature.properties.date_fin_mesure) < new Date(DATE_FIN_MESURE))
76-
{
73+
else {
74+
feature.properties.name = `${feature.properties.code_bss} (${feature.properties.nom_commune})`
75+
if (new Date(feature.properties.date_fin_mesure) < new Date(DATE_FIN_MESURE)) {
7776
console.log("Warning: station "+feature.properties.bss_id+" is not in service anymore (date_fin_mesure = "+feature.properties.date_fin_mesure+")")
7877
// We add a property to the station to indicate that it is not up to date (in_service = false)
7978
feature.properties.en_service = false
80-
}
81-
else{
79+
} else {
8280
// We add a property to the station to indicate that it is up to date (in_service = true)
8381
feature.properties.en_service = true
8482
totalInService++
8583
}
8684
stations.push(feature)
87-
8885
}
8986
})
9087
item.data = stations

0 commit comments

Comments
 (0)