Skip to content

Commit

Permalink
Bufr ingest fixes (#210)
Browse files Browse the repository at this point in the history
* BUFR: handle zero size Section3

* change getValue return value, when Missing

* BUFR: skip values when period is missing

* Improve missing values handling

* BUFR: fix int getValue

* BUFR: fix compressed text size

* BUFR: skip subset, if early or late

* BUFR: measure start/end is defined by [ 0 04 025 ]

* BUFR: skip duplicated pressure values

* BUFR: fix precipitation period sign

* BUFR: change the default HITIME

* datastore: change the default HITIME

* BUFR: increase logbuffer size

* BUFR: add bufr state id to ISO country code conversion

* BUFR: fix compressed missing string

* BUFR: iso country code to the gen wigos

* BUFR: removed unnecessary station name check
  • Loading branch information
istvans-mn authored Nov 22, 2024
1 parent 3f3a241 commit 32838ee
Show file tree
Hide file tree
Showing 9 changed files with 351 additions and 158 deletions.
2 changes: 1 addition & 1 deletion datastore/datastore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ The following environment variables are supported:
| `PGDBNAME` | No | `data` | PostgreSQL database name. |
| `DYNAMICTIME` | No | `true` | Whether the valid time range is _dynamic_ or _static_ (defined below). |
| `LOTIME` | No | `86400` | The _earliest_ valid time as seconds to be either [1] subtracted from the current time (if the valid time range is _dynamic_) or [2] added to UNIX epoch (1970-01-01T00:00:00Z) (if the valid time range is _static_). In the case of a _static_ valid time range, the `LOTIME` can optionally be specified as an ISO-8601 datetime of the exact form `2023-10-10T00:00:00Z`. |
| `HITIME` | No | `-2` | Same as `LOTIME`, but for the _latest_ valid time. Note a default leeway of 2 seconds into the future to reduce risk of missing the newest observations. |
| `HITIME` | No | `-600` | Same as `LOTIME`, but for the _latest_ valid time. Note a default leeway of 10 minutes into the future to reduce risk of missing visual observations. |
| `CLEANUPINTERVAL` | No | `86400` | The minimum time duration in seconds between automatic cleanups (like removing obsolete observations from the physical store). |
| `PUTOBSLIMIT` | No | `100000` | Maximum number of observations allowed in a single call to `PutObservations`. |

Expand Down
2 changes: 1 addition & 1 deletion datastore/datastore/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func initValidTimeRange() {
loTimeName := "LOTIME"
hiTimeName := "HITIME"
defaultLoTimeSecs := int64(86400)
defaultHiTimeSecs := int64(-2) // add leeway to reduce risk of missing the newest observations
defaultHiTimeSecs := int64(-600) // the reference time of visual observations is the next hour

if dynamicTime {
loTimeSecs = getSecs(loTimeName, defaultLoTimeSecs, false)
Expand Down
11 changes: 11 additions & 0 deletions ingest/src/ingest/bufr/CountryCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,4 +308,15 @@ static const std::list<cc_conv> country_codes = {

};

inline int bufrToIsocc(const int bufr_state_id) {
int ret = 0;
for (auto cc : country_codes) {
if (cc.bufr_code == bufr_state_id) {
ret = cc.iso_code;
break;
}
}
return ret;
}

#endif
Loading

1 comment on commit 32838ee

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Unit Test Coverage Report
FileStmtsMissCoverMissing
__init__.py00100% 
datastore_pb2.py614821%34–81
datastore_pb2_grpc.py542750%15–16, 19, 65–80, 121–123, 128–130, 135–137, 142–144, 148–173, 219, 246, 273, 300
export_metrics.py100100% 
grpc_getter.py201145%15–19, 23–26, 30–32, 36–38
locustfile.py15150%1–31
main.py43784%45, 50, 60, 70–71, 81–82
metadata_endpoints.py663252%45–54, 58, 85, 100–220, 224
response_classes.py50100% 
utilities.py1744674%20, 38, 45, 67–70, 78–89, 94–101, 121, 125, 127, 155, 161, 179, 193–194, 198, 214–218, 222–228, 232–234, 264, 268, 290, 295
custom_geo_json
   edr_feature_collection.py60100% 
formatters
   __init__.py110100% 
   covjson.py60198%91
   geojson.py21290%27, 52
openapi
   custom_dimension_examples.py40100% 
   edr_query_parameter_descriptions.py110100% 
   openapi_examples.py130100% 
routers
   __init__.py00100% 
   edr.py101496%348–349, 438–439
   feature.py471960%99–132, 148–153, 159–181
TOTAL72221271% 

Title Coverage Tests Skipped Failures Errors Time
API Unit Tests Coverage 30 0 💤 0 ❌ 0 🔥 1.842s ⏱️
Ingest Unit Tests Coverage 16 0 💤 0 ❌ 0 🔥 11.487s ⏱️

Please sign in to comment.