Skip to content

Commit

Permalink
wis2box-create-config initial version (#476)
Browse files Browse the repository at this point in the history
* wis2box-create-config initial version

* flake8 corrections

* add station_list_example.csv

* new setup instructions

* remove setup-new

* use file templating, rename template files, update doc

* fix doc

* update countries JSON, add country name to workflow

---------

Co-authored-by: Tom Kralidis <[email protected]>
  • Loading branch information
maaikelimper and tomkralidis authored Sep 5, 2023
1 parent becde08 commit 358af81
Show file tree
Hide file tree
Showing 10 changed files with 2,439 additions and 164 deletions.
1,562 changes: 1,562 additions & 0 deletions config-templates/countries.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions config-templates/csv2bufr_mappings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"inputShortDelayedDescriptorReplicationFactor": [],
"inputDelayedDescriptorReplicationFactor": [0,0],
"inputExtendedDelayedDescriptorReplicationFactor": [],
"wigos_station_identifier": "data:WIGOS_ID",
"number_header_rows": 1,
"column_names_row": 1,
"delimiter": ",",
"quoting": "QUOTE_NONE",
"header":[
{"eccodes_key": "edition", "value": "const:4"},
{"eccodes_key": "masterTableNumber", "value": "const:0"},
{"eccodes_key": "bufrHeaderCentre", "value": "const:0"},
{"eccodes_key": "bufrHeaderSubCentre", "value": "const:0"},
{"eccodes_key": "updateSequenceNumber", "value": "const:0"},
{"eccodes_key": "dataCategory", "value": "const:0"},
{"eccodes_key": "internationalDataSubCategory", "value": "const:6"},
{"eccodes_key": "masterTablesVersionNumber", "value": "const:30"},
{"eccodes_key": "numberOfSubsets", "value": "const:1"},
{"eccodes_key": "observedData", "value": "const:1"},
{"eccodes_key": "compressedData", "value": "const:0"},
{"eccodes_key": "typicalYear", "value":"data:YEAR"},
{"eccodes_key": "typicalMonth", "value":"data:MONTH"},
{"eccodes_key": "typicalDay", "value":"data:DAY OF MONTH"},
{"eccodes_key": "typicalHour", "value":"data:HOUR"},
{"eccodes_key": "typicalMinute", "value":"data:MINUTE"},
{"eccodes_key": "unexpandedDescriptors", "value": "array:301150,307080"}
],
"data": [
{"eccodes_key": "#1#wigosIdentifierSeries", "value":"data:_wsi_series"},
{"eccodes_key": "#1#wigosIssuerOfIdentifier", "value":"data:_wsi_issuer"},
{"eccodes_key": "#1#wigosIssueNumber", "value":"data:_wsi_issue_number"},
{"eccodes_key": "#1#wigosLocalIdentifierCharacter", "value":"data:_wsi_local"},
{"eccodes_key": "#1#year", "value":"data:YEAR", "valid_min": "const:2000", "valid_max": "const:2100"},
{"eccodes_key": "#1#month", "value":"data:MONTH", "valid_min": "const:1", "valid_max": "const:12"},
{"eccodes_key": "#1#day", "value":"data:DAY OF MONTH", "valid_min": "const:1", "valid_max": "const:31"},
{"eccodes_key": "#1#hour", "value":"data:HOUR", "valid_min": "const:0", "valid_max": "const:23"},
{"eccodes_key": "#1#minute", "value":"data:MINUTE", "valid_min": "const:0", "valid_max": "const:59"},
{"eccodes_key": "#1#latitude", "value":"data:LATITUDE", "valid_min": "const:-90", "valid_max": "const:90"},
{"eccodes_key": "#1#longitude", "value":"data:LONGITUDE", "valid_min": "const:-180", "valid_max": "const:180"},
{"eccodes_key": "#1#heightOfStationGroundAboveMeanSeaLevel", "value":"data:STATION HEIGHT (m)"},
{"eccodes_key": "#1#heightOfBarometerAboveMeanSeaLevel", "value":"data:BP HEIGHT (m)"},
{"eccodes_key": "#1#nonCoordinatePressure", "value":"data:BARO PRESSURE(hPa)"},
{"eccodes_key": "#1#airTemperature", "value":"data:AIR TEMP(C)", "offset": "const:273.15", "scale": "const:0"},
{"eccodes_key": "#1#dewpointTemperature", "value":"data:DEW POINT(C)", "offset": "const:273.15", "scale": "const:0"},
{"eccodes_key": "#1#relativeHumidity", "value":"data:REL HUMID(%)"},
{"eccodes_key": "#1#windSpeed", "value":"data:WIND SPD(m/s)"},
{"eccodes_key": "#1#windDirection", "value":"data:WIND DIR(deg)"},
{"eccodes_key": "#2#timePeriod", "value":"const:-1"},
{"eccodes_key": "#1#totalSunshine", "value":"data:HOURS SUN(hrs)"},
{"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value":"data:PRECIP(mm)"},
{"eccodes_key": "#1#maximumWindGustSpeed", "value":"data:GUST(m/s)"},
{"eccodes_key": "#1#maximumWindGustDirection", "value": "data:GUSTDIR(deg)"},
{"eccodes_key": "#14#timePeriod", "value":"const:-1"},
{"eccodes_key": "#1#globalSolarRadiationIntegratedOverPeriodSpecified", "value":"data:SOLAR RAD(WH/m2)", "offset": "const:0", "scale": "const:3.56"}
]
}
47 changes: 47 additions & 0 deletions config-templates/data-mappings.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
data:
$COUNTRY_CODE.$CENTRE_ID.data.core.weather.surface-based-observations.synop:
plugins:
txt:
- plugin: wis2box.data.synop2bufr.ObservationDataSYNOP2BUFR
notify: true
buckets:
- $${WIS2BOX_STORAGE_INCOMING}
file-pattern: '^.*-(\d{4})(\d{2}).*\.txt$$'
csv:
- plugin: wis2box.data.csv2bufr.ObservationDataCSV2BUFR
template: /data/wis2box/csv2bufr_mappings.json
notify: true
buckets:
- $${WIS2BOX_STORAGE_INCOMING}
file-pattern: '^.*\.csv$$'
bin:
- plugin: wis2box.data.bufr4.ObservationDataBUFR
notify: true
buckets:
- $${WIS2BOX_STORAGE_INCOMING}
file-pattern: '^.*\.bin$$'
bufr:
- plugin: wis2box.data.bufr4.ObservationDataBUFR
notify: true
buckets:
- $${WIS2BOX_STORAGE_INCOMING}
file-pattern: '^.*\.bufr$$'
bufr4:
- plugin: wis2box.data.bufr2geojson.ObservationDataBUFR2GeoJSON
buckets:
- $${WIS2BOX_STORAGE_PUBLIC}
file-pattern: '^WIGOS_(\d-\d+-\d+-\w+)_.*\.bufr4$$'
COUNTRY_CODE.CENTRE_ID.data.core.weather.surface-based-observations.temp:
plugins:
bin:
- plugin: wis2box.data.bufr4.ObservationDataBUFR
notify: true
buckets:
- $${WIS2BOX_STORAGE_INCOMING}
file-pattern: '^.*\.bin$$'
bufr:
- plugin: wis2box.data.bufr4.ObservationDataBUFR
notify: true
buckets:
- $${WIS2BOX_STORAGE_INCOMING}
file-pattern: '^.*\.bufr$$'
63 changes: 63 additions & 0 deletions config-templates/metadata-synop.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
wis2box:
retention: P30D
topic_hierarchy: $COUNTRY_CODE.$CENTRE_ID.data.core.weather.surface-based-observations.synop
country: $COUNTRY_CODE
centre_id: $CENTRE_ID

mcf:
version: 1.0

metadata:
identifier: urn:x-wmo:md:$COUNTRY_CODE:$CENTRE_ID:surface-based-observations.synop
language: en
charset: utf8
hierarchylevel: dataset

identification:
language: en
charset: utf8
title: Surface weather observations from $CENTRE_NAME
abstract: Surface weather observations from $CENTRE_NAME
dates:
creation: $CREATION_DATE
publication: $PUBLICATION_DATE
keywords:
default:
keywords:
- upper-air weather
- observations
wmo:
keywords:
- weatherObservations
keywords_type: theme
vocabulary:
name: WMO Category Code
url: https://github.com/wmo-im/wcmp-codelists/blob/main/codelists/WMO_CategoryCode.csv
extents:
spatial:
- bbox: [$BOUNDING_BOX]
crs: 4326
temporal:
- begin: BEGIN_DATE
end: null
resolution: P1H
wmo_data_policy: core

contact:
pointOfContact: &contact_poc
organization: $CENTRE_NAME
url: NA
individualname: NA
positionname: NA
phone: NA
fax: NA
address: NA
city: NA
administrativearea: NA
postalcode: NA
country: $COUNTRY_NAME
email: $WIS2BOX_EMAIL
hoursofservice: NA
contactinstructions: email

distributor: *contact_poc
63 changes: 63 additions & 0 deletions config-templates/metadata-temp.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
wis2box:
retention: P30D
topic_hierarchy: $COUNTRY_CODE.$CENTRE_ID.data.core.weather.surface-based-observations.temp
country: $COUNTRY_CODE
centre_id: $CENTRE_ID

mcf:
version: 1.0

metadata:
identifier: urn:x-wmo:md:$COUNTRY_CODE:$CENTRE_ID:surface-based-observations.temp
language: en
charset: utf8
hierarchylevel: dataset

identification:
language: en
charset: utf8
title: Upper-air weather observations from $CENTRE_NAME
abstract: Upper-air weather observations from $CENTRE_NAME
dates:
creation: $CREATION_DATE
publication: $PUBLICATION_DATE
keywords:
default:
keywords:
- upper-air weather
- observations
wmo:
keywords:
- weatherObservations
keywords_type: theme
vocabulary:
name: WMO Category Code
url: https://github.com/wmo-im/wcmp-codelists/blob/main/codelists/WMO_CategoryCode.csv
extents:
spatial:
- bbox: [$BOUNDING_BOX]
crs: 4326
temporal:
- begin: BEGIN_DATE
end: null
resolution: P12H
wmo_data_policy: core

contact:
pointOfContact: &contact_poc
organization: $CENTRE_NAME
url: NA
individualname: NA
positionname: NA
phone: NA
fax: NA
address: NA
city: NA
administrativearea: NA
postalcode: NA
country: $COUNTRY_NAME
email: $WIS2BOX_EMAIL
hoursofservice: NA
contactinstructions: email

distributor: *contact_poc
4 changes: 4 additions & 0 deletions config-templates/station_list_example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
station_name,wigos_station_identifier,traditional_station_identifier,facility_type,latitude,longitude,elevation,territory_name,wmo_region
EXAMPLE1-SURFACE,0-454-0-EXAMPLE,,Land (fixed),-14.98333,34.96666,618,Malawi,I
EXAMPLE2-SURFACE,0-20000-0-12345,12345,Land (fixed),41.56361,14.65500,793,Italy,VI
EXAMPLE3-UPPERAIR,0-52-0-5432,54321,Air (fixed),13.08585,-59.48701,56.6,Barbados,IV
Loading

0 comments on commit 358af81

Please sign in to comment.