From 178ce984a6459e36bf9defeefcd1baed9a85ae52 Mon Sep 17 00:00:00 2001 From: RoryPTB <47696929+RoryPTB@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:53:45 +0200 Subject: [PATCH 1/7] Capture of pymetdecoder warnings and support for absent precipitation groups when iR=3 --- synop2bufr/__init__.py | 60 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/synop2bufr/__init__.py b/synop2bufr/__init__.py index 16a7b0d..c733c10 100644 --- a/synop2bufr/__init__.py +++ b/synop2bufr/__init__.py @@ -29,6 +29,7 @@ import re from typing import Iterator +# Now import pymetdecoder and csv2bufr from csv2bufr import BUFRMessage from pymetdecoder import synop @@ -36,6 +37,34 @@ LOGGER = logging.getLogger(__name__) +# Global array to store warnings +warning_msgs = [] + +# ! Configure the pymetdecoder logger to append warnings to the above array + + +class ArrayHandler(logging.Handler): + + # The emit method will be called every time there is a log + def emit(self, record): + # If log level is warning, append to the warnings messages array + if record.levelname == "WARNING": + warning_msgs.append(self.format(record)) + + +array_handler = ArrayHandler() +# Set format to be just the pure warning message with no metadata +formatter = logging.Formatter('%(message)s') +array_handler.setFormatter(formatter) +# Set level to ensure warnings are captured +array_handler.setLevel(logging.WARNING) + +# Grab pymetdecoder logger +PYMETDECODER_LOGGER = logging.getLogger('pymetdecoder') +PYMETDECODER_LOGGER.setLevel(logging.WARNING) +# Use this list handler in the pymetdecoder logger +PYMETDECODER_LOGGER.addHandler(array_handler) + # status codes FAILED = 0 PASSED = 1 @@ -87,6 +116,7 @@ MAPPINGS_307080 = f"{THISDIR}{os.sep}resources{os.sep}synop-mappings-307080.json" # noqa MAPPINGS_307096 = f"{THISDIR}{os.sep}resources{os.sep}synop-mappings-307096.json" # noqa + # Load template mappings files, this will be updated for each message. with open(MAPPINGS_307080) as fh: _mapping_307080 = json.load(fh) @@ -105,8 +135,10 @@ def parse_synop(message: str, year: int, month: int) -> dict: :returns: `dict` of parsed SYNOP message """ + # Make warning messages array global + global warning_msgs - # Get the full output decoded message from the Pymetdecoder package + # Get the full output decoded message from the pymetdecoder package try: decoded = synop.SYNOP().decode(message) except Exception as e: @@ -116,7 +148,7 @@ def parse_synop(message: str, year: int, month: int) -> dict: # Get the template dictionary to be filled output = deepcopy(synop_template) - # SECTIONs 0 AND 1 + # SECTIONS 0 AND 1 # The following do not need to be converted output['report_type'] = message[0:4] @@ -190,7 +222,6 @@ def parse_synop(message: str, year: int, month: int) -> dict: output['station_id'] = None output['block_no'] = None output['station_no'] = None - # ! Removed precipitation indicator as it is redundant # Get region of report if decoded.get('region') is not None: @@ -958,6 +989,19 @@ def rad_convert(rad, time): except Exception: output['ps3_time_period'] = None + # Precipitation indicator iR is needed to determine whether the + # section 1 and section 3 precipitation groups are missing because there + # is no data, or because there has been 0 precipitation observed + if decoded.get('precipitation_indicator') is not None: + if decoded['precipitation_indicator'].get('value') is not None: + + iR = decoded['precipitation_indicator']['value'] + + # iR = 3 means 0 precipitation observed + if iR == 3: + output['precipitation_s1'] = 0 + output['precipitation_s3'] = 0 + # Group 7 7R24R24R24R24 - this group is the same as group 6, but # over a 24 hour time period if decoded.get('precipitation_24h') is not None: @@ -1202,10 +1246,12 @@ def transform(data: str, metadata: str, year: int, :returns: iterator """ - # Array to store warning and error messages - warning_msgs = [] + # Array to store error messages error_msgs = [] + # Make warning messages array global + global warning_msgs + # =================== # First parse metadata file # =================== @@ -1521,6 +1567,10 @@ def transform(data: str, metadata: str, year: int, # now yield result back to caller yield result + # Reset warning messages array for next iteration + print("Warnings array: ", warning_msgs) + warning_msgs = [] + # Output conversion status to user if conversion_success[tsi]: LOGGER.info(f"Station {tsi} report converted") From e09400d11597e377414b96f3a7de7975af5d0b75 Mon Sep 17 00:00:00 2001 From: RoryPTB <47696929+RoryPTB@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:27:20 +0200 Subject: [PATCH 2/7] Capture of csv2bufr warnings --- synop2bufr/__init__.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/synop2bufr/__init__.py b/synop2bufr/__init__.py index c733c10..097d9aa 100644 --- a/synop2bufr/__init__.py +++ b/synop2bufr/__init__.py @@ -30,8 +30,8 @@ from typing import Iterator # Now import pymetdecoder and csv2bufr -from csv2bufr import BUFRMessage from pymetdecoder import synop +from csv2bufr import BUFRMessage __version__ = '0.5.1' @@ -40,7 +40,7 @@ # Global array to store warnings warning_msgs = [] -# ! Configure the pymetdecoder logger to append warnings to the above array +# ! Configure the pymetdecoder/csv2bufr loggers to append warnings to the above array class ArrayHandler(logging.Handler): @@ -52,6 +52,7 @@ def emit(self, record): warning_msgs.append(self.format(record)) +# Create instance of array handler array_handler = ArrayHandler() # Set format to be just the pure warning message with no metadata formatter = logging.Formatter('%(message)s') @@ -59,16 +60,24 @@ def emit(self, record): # Set level to ensure warnings are captured array_handler.setLevel(logging.WARNING) -# Grab pymetdecoder logger +# Grab pymetdecoder logger and configure PYMETDECODER_LOGGER = logging.getLogger('pymetdecoder') PYMETDECODER_LOGGER.setLevel(logging.WARNING) -# Use this list handler in the pymetdecoder logger +# Use this array handler in the pymetdecoder logger PYMETDECODER_LOGGER.addHandler(array_handler) +# Grab csv2bufr logger and configure +CSV2BUFR_LOGGER = logging.getLogger('csv2bufr') +CSV2BUFR_LOGGER.setLevel(logging.WARNING) +# Use this array handler in the csv2bufr logger +CSV2BUFR_LOGGER.addHandler(array_handler) + # status codes FAILED = 0 PASSED = 1 +# ! Initialise the template dictionary and mappings + # Enumerate the keys _keys = ['report_type', 'year', 'month', 'day', 'hour', 'minute', @@ -1568,7 +1577,6 @@ def transform(data: str, metadata: str, year: int, yield result # Reset warning messages array for next iteration - print("Warnings array: ", warning_msgs) warning_msgs = [] # Output conversion status to user From 430b0feae0090475472be55fc1651d8399116baa Mon Sep 17 00:00:00 2001 From: RoryPTB <47696929+RoryPTB@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:14:03 +0200 Subject: [PATCH 3/7] Flake 8 fix --- synop2bufr/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synop2bufr/__init__.py b/synop2bufr/__init__.py index 097d9aa..58b8038 100644 --- a/synop2bufr/__init__.py +++ b/synop2bufr/__init__.py @@ -40,7 +40,7 @@ # Global array to store warnings warning_msgs = [] -# ! Configure the pymetdecoder/csv2bufr loggers to append warnings to the above array +# ! Configure the pymetdecoder/csv2bufr loggers to append warnings to the array class ArrayHandler(logging.Handler): From 3251cd6221b1a620ef9bf96661634fd3c8b179f6 Mon Sep 17 00:00:00 2001 From: RoryPTB <47696929+RoryPTB@users.noreply.github.com> Date: Tue, 12 Sep 2023 12:46:20 +0200 Subject: [PATCH 4/7] Limits added to mapping files --- .../resources/synop-mappings-307080.json | 171 +++++++++--------- .../resources/synop-mappings-307096.json | 166 ++++++++--------- 2 files changed, 169 insertions(+), 168 deletions(-) diff --git a/synop2bufr/resources/synop-mappings-307080.json b/synop2bufr/resources/synop-mappings-307080.json index cd28d37..6cc9c69 100644 --- a/synop2bufr/resources/synop-mappings-307080.json +++ b/synop2bufr/resources/synop-mappings-307080.json @@ -29,98 +29,99 @@ {"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#latitude", "value": "data:_latitude"}, - {"eccodes_key": "#1#longitude", "value": "data:_longitude"}, - {"eccodes_key": "#1#heightOfStationGroundAboveMeanSeaLevel", "value":"data:_station_height"}, - {"eccodes_key": "#1#blockNumber", "value": "data:block_no"}, - {"eccodes_key": "#1#stationNumber", "value": "data:station_no"}, + {"eccodes_key": "#1#latitude", "value": "data:_latitude", "valid_min": "const:-90.0", "valid_max": "const:245.54431"}, + {"eccodes_key": "#1#longitude", "value": "data:_longitude", "valid_min": "const:-180.0", "valid_max": "const:491.08863"}, + {"eccodes_key": "#1#heightOfStationGroundAboveMeanSeaLevel", "value":"data:_station_height", "valid_min": "const:-400.0", "valid_max": "const:12707.1"}, + {"eccodes_key": "#1#heightOfBarometerAboveMeanSeaLevel", "value":"data:_barometer_height", "valid_min": "const:-400.0", "valid_max": "const:12707.1"}, + {"eccodes_key": "#1#blockNumber", "value": "data:block_no", "valid_min": "const:0", "valid_max": "const:127"}, + {"eccodes_key": "#1#stationNumber", "value": "data:station_no", "valid_min": "const:0", "valid_max": "const:1023"}, {"eccodes_key": "#1#stationOrSiteName", "value": "data:station_id"}, - {"eccodes_key": "#1#stationType", "value": "data:WMO_station_type"}, - {"eccodes_key": "#1#year", "value": "data:year"}, - {"eccodes_key": "#1#month", "value": "data:month"}, - {"eccodes_key": "#1#day", "value": "data:day"}, - {"eccodes_key": "#1#hour", "value": "data:hour"}, - {"eccodes_key": "#1#minute", "value": "data:minute"}, - {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure"}, - {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure"}, - {"eccodes_key": "#1#3HourPressureChange", "value": "data:3hr_pressure_change"}, - {"eccodes_key": "#1#characteristicOfPressureTendency", "value": "data:pressure_tendency_characteristic"}, - {"eccodes_key": "#1#24HourPressureChange", "value": "data:24hr_pressure_change"}, - {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface"}, - {"eccodes_key": "#1#nonCoordinateGeopotentialHeight", "value": "data:geopotential_height"}, - {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature"}, - {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature"}, - {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity"}, - {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility"}, - {"eccodes_key": "#1#totalPrecipitationPast24Hours", "value": "data:precipitation_24h"}, - {"eccodes_key": "#1#cloudCoverTotal", "value": "data:cloud_cover"}, - {"eccodes_key": "#1#verticalSignificanceSurfaceObservations", "value": "data:cloud_vs_s1"}, - {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1"}, - {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base"}, - {"eccodes_key": "#1#cloudType", "value": "data:low_cloud_type"}, - {"eccodes_key": "#2#cloudType", "value": "data:middle_cloud_type"}, - {"eccodes_key": "#3#cloudType", "value": "data:high_cloud_type"}, - {"eccodes_key": "#2#verticalSignificanceSurfaceObservations", "value": "const:7"}, - {"eccodes_key": "#3#verticalSignificanceSurfaceObservations", "value": "const:8"}, - {"eccodes_key": "#4#verticalSignificanceSurfaceObservations", "value": "const:9"}, - {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction"}, - {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction"}, - {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction"}, - {"eccodes_key": "#5#verticalSignificanceSurfaceObservations", "value": "const:7"}, - {"eccodes_key": "#6#verticalSignificanceSurfaceObservations", "value": "const:8"}, - {"eccodes_key": "#7#verticalSignificanceSurfaceObservations", "value": "const:9"}, - {"eccodes_key": "#1#stateOfGround", "value": "data:ground_state"}, - {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth"}, - {"eccodes_key": "#1#groundMinimumTemperaturePast12Hours", "value": "data:ground_temperature"}, - {"eccodes_key": "#1#presentWeather", "value": "data:present_weather"}, - {"eccodes_key": "#1#pastWeather1", "value": "data:past_weather_1"}, - {"eccodes_key": "#1#pastWeather2", "value": "data:past_weather_2"}, - {"eccodes_key": "#1#timePeriod", "value": "data:past_weather_time_period"}, - {"eccodes_key": "#2#timePeriod", "value": "const:-1"}, - {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr"}, - {"eccodes_key": "#3#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr"}, - {"eccodes_key": "#4#timePeriod", "value": "data:ps1_time_period"}, - {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1"}, - {"eccodes_key": "#5#timePeriod", "value": "data:ps3_time_period"}, - {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3"}, - {"eccodes_key": "#6#timePeriod", "value": "data:maximum_temperature_period_start"}, - {"eccodes_key": "#7#timePeriod", "value": "data:maximum_temperature_period_end"}, - {"eccodes_key": "#1#maximumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:maximum_temperature"}, - {"eccodes_key": "#8#timePeriod", "value": "data:minimum_temperature_period_start"}, - {"eccodes_key": "#9#timePeriod", "value": "data:minimum_temperature_period_end"}, - {"eccodes_key": "#1#minimumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:minimum_temperature"}, - {"eccodes_key": "#1#instrumentationForWindMeasurement", "value": "data:wind_indicator"}, + {"eccodes_key": "#1#stationType", "value": "data:WMO_station_type", "valid_min": "const:0", "valid_max": "const:3"}, + {"eccodes_key": "#1#year", "value": "data:year", "valid_min": "const:0", "valid_max": "const:4095"}, + {"eccodes_key": "#1#month", "value": "data:month", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#day", "value": "data:day", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#hour", "value": "data:hour", "valid_min": "const:0", "valid_max": "const:31"}, + {"eccodes_key": "#1#minute", "value": "data:minute", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#3HourPressureChange", "value": "data:3hr_pressure_change", "valid_min": "const:-5000", "valid_max": "const:5230"}, + {"eccodes_key": "#1#characteristicOfPressureTendency", "value": "data:pressure_tendency_characteristic", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#24HourPressureChange", "value": "data:24hr_pressure_change", "valid_min": "const:-10000", "valid_max": "const:10470"}, + {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#nonCoordinateGeopotentialHeight", "value": "data:geopotential_height", "valid_min": "const:-1000", "valid_max": "const:130071"}, + {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity", "valid_min": "const:0", "valid_max": "const:127"}, + {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility", "valid_min": "const:0", "valid_max": "const:81910"}, + {"eccodes_key": "#1#totalPrecipitationPast24Hours", "value": "data:precipitation_24h","valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#1#cloudCoverTotal", "value": "data:cloud_cover", "valid_min": "const:0", "valid_max": "const:127"}, + {"eccodes_key": "#1#verticalSignificanceSurfaceObservations", "value": "data:cloud_vs_s1", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base", "valid_min": "const:-400", "valid_max": "const:20070"}, + {"eccodes_key": "#1#cloudType", "value": "data:low_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#2#cloudType", "value": "data:middle_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#3#cloudType", "value": "data:high_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#2#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#3#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#4#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#5#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#6#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#7#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#stateOfGround", "value": "data:ground_state", "valid_min": "const:0", "valid_max": "const:31"}, + {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth", "valid_min": "const:-0.02", "valid_max": "const:655.33"}, + {"eccodes_key": "#1#groundMinimumTemperaturePast12Hours", "value": "data:ground_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#presentWeather", "value": "data:present_weather", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#1#pastWeather1", "value": "data:past_weather_1", "valid_min": "const:0", "valid_max": "const:31"}, + {"eccodes_key": "#1#pastWeather2", "value": "data:past_weather_2", "valid_min": "const:0", "valid_max": "const:31"}, + {"eccodes_key": "#1#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#2#timePeriod", "value": "const:-1", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr", "valid_min": "const:0", "valid_max": "const:2047"}, + {"eccodes_key": "#3#timePeriod", "value": "const:-24", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr", "valid_min": "const:0", "valid_max": "const:2047"}, + {"eccodes_key": "#4#timePeriod", "value": "data:ps1_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#5#timePeriod", "value": "data:ps3_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#6#timePeriod", "value": "data:maximum_temperature_period_start", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#7#timePeriod", "value": "data:maximum_temperature_period_end", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#1#maximumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:maximum_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#8#timePeriod", "value": "data:minimum_temperature_period_start", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#9#timePeriod", "value": "data:minimum_temperature_period_end", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#1#minimumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:minimum_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#instrumentationForWindMeasurement", "value": "data:wind_indicator", "valid_min": "const:0", "valid_max": "const:15"}, {"eccodes_key": "#1#timeSignificance", "value": "const:2"}, {"eccodes_key": "#10#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#windDirection", "value": "data:wind_direction"}, - {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed"}, + {"eccodes_key": "#1#windDirection", "value": "data:wind_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed", "valid_min": "const:0.0", "valid_max": "const:409.5"}, {"eccodes_key": "#11#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1"}, - {"eccodes_key": "#12#timePeriod", "value": "data:past_weather_time_period"}, - {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2"}, + {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#12#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2", "valid_min": "const:0.0", "valid_max": "const:409.5"}, {"eccodes_key": "#13#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#1#typeOfInstrumentationForEvaporationMeasurement", "value": "data:evaporation_instrument"}, - {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration"}, - {"eccodes_key": "#4#cloudType", "value": "data:e_cloud_genus"}, - {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:e_cloud_direction"}, - {"eccodes_key": "#1#elevation", "value": "data:e_cloud_elevation"}, + {"eccodes_key": "#1#typeOfInstrumentationForEvaporationMeasurement", "value": "data:evaporation_instrument", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration", "valid_min": "const:0.0", "valid_max": "const:102.3"}, + {"eccodes_key": "#4#cloudType", "value": "data:e_cloud_genus", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#bearingOrAzimuth", "value": "data:e_cloud_direction", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#elevation", "value": "data:e_cloud_elevation", "valid_min": "const:-90.0", "valid_max": "const:237.67"}, {"eccodes_key": "#14#timePeriod", "value": "const:-1"}, - {"eccodes_key": "#1#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_1hr"}, - {"eccodes_key": "#1#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_1hr"}, - {"eccodes_key": "#1#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_1hr"}, - {"eccodes_key": "#1#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_1hr"}, - {"eccodes_key": "#1#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_1hr"}, - {"eccodes_key": "#1#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_1hr"}, + {"eccodes_key": "#1#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_1hr", "valid_min": "const:-163840000", "valid_max": "const:163830000"}, + {"eccodes_key": "#1#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_1hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#1#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_1hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#1#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_1hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#1#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_1hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, + {"eccodes_key": "#1#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_1hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, {"eccodes_key": "#15#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#2#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_24hr"}, - {"eccodes_key": "#2#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_24hr"}, - {"eccodes_key": "#2#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_24hr"}, - {"eccodes_key": "#2#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_24hr"}, - {"eccodes_key": "#2#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_24hr"}, - {"eccodes_key": "#2#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_24hr"}, - {"eccodes_key": "#16#timePeriod", "value": "data:past_weather_time_period"}, + {"eccodes_key": "#2#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_24hr", "valid_min": "const:-163840000", "valid_max": "const:163830000"}, + {"eccodes_key": "#2#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_24hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#2#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_24hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#2#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_24hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#2#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_24hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, + {"eccodes_key": "#2#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_24hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, + {"eccodes_key": "#16#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048","valid_max": "const:2047"}, {"eccodes_key": "#17#timePeriod", "value": "const:0"}, - {"eccodes_key": "#1#temperatureChangeOverSpecifiedPeriod", "value": "data:temperature_change"} + {"eccodes_key": "#1#temperatureChangeOverSpecifiedPeriod", "value": "data:temperature_change", "valid_min": "const:-30", "valid_max": "const:33"} ] } \ No newline at end of file diff --git a/synop2bufr/resources/synop-mappings-307096.json b/synop2bufr/resources/synop-mappings-307096.json index b0ea652..d9b6e72 100644 --- a/synop2bufr/resources/synop-mappings-307096.json +++ b/synop2bufr/resources/synop-mappings-307096.json @@ -29,100 +29,100 @@ {"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#latitude", "value": "data:_latitude"}, - {"eccodes_key": "#1#longitude", "value": "data:_longitude"}, - {"eccodes_key": "#1#heightOfStationGroundAboveMeanSeaLevel", "value":"data:_station_height"}, - {"eccodes_key": "#1#heightOfBarometerAboveMeanSeaLevel", "value":"data:_barometer_height"}, - {"eccodes_key": "#1#blockNumber", "value": "data:block_no"}, - {"eccodes_key": "#1#stationNumber", "value": "data:station_no"}, + {"eccodes_key": "#1#latitude", "value": "data:_latitude", "valid_min": "const:-90.0", "valid_max": "const:245.54431"}, + {"eccodes_key": "#1#longitude", "value": "data:_longitude", "valid_min": "const:-180.0", "valid_max": "const:491.08863"}, + {"eccodes_key": "#1#heightOfStationGroundAboveMeanSeaLevel", "value":"data:_station_height", "valid_min": "const:-400.0", "valid_max": "const:12707.1"}, + {"eccodes_key": "#1#heightOfBarometerAboveMeanSeaLevel", "value":"data:_barometer_height", "valid_min": "const:-400.0", "valid_max": "const:12707.1"}, + {"eccodes_key": "#1#blockNumber", "value": "data:block_no", "valid_min": "const:0", "valid_max": "const:127"}, + {"eccodes_key": "#1#stationNumber", "value": "data:station_no", "valid_min": "const:0", "valid_max": "const:1023"}, {"eccodes_key": "#1#stationOrSiteName", "value": "data:station_id"}, - {"eccodes_key": "#1#stationType", "value": "data:WMO_station_type"}, - {"eccodes_key": "#1#year", "value": "data:year"}, - {"eccodes_key": "#1#month", "value": "data:month"}, - {"eccodes_key": "#1#day", "value": "data:day"}, - {"eccodes_key": "#1#hour", "value": "data:hour"}, - {"eccodes_key": "#1#minute", "value": "data:minute"}, - {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure"}, - {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure"}, - {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface"}, - {"eccodes_key": "#1#nonCoordinateGeopotentialHeight", "value": "data:geopotential_height"}, - {"eccodes_key": "#1#3HourPressureChange", "value": "data:3hr_pressure_change"}, - {"eccodes_key": "#1#characteristicOfPressureTendency", "value": "data:pressure_tendency_characteristic"}, - {"eccodes_key": "#1#24HourPressureChange", "value": "data:24hr_pressure_change"}, - {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature"}, - {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature"}, - {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity"}, - {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility"}, - {"eccodes_key": "#1#stateOfGround", "value": "data:ground_state"}, - {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth"}, - {"eccodes_key": "#1#groundMinimumTemperaturePast12Hours", "value": "data:ground_temperature"}, - {"eccodes_key": "#1#cloudCoverTotal", "value": "data:cloud_cover"}, - {"eccodes_key": "#1#verticalSignificanceSurfaceObservations", "value": "data:cloud_vs_s1"}, - {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1"}, - {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base"}, - {"eccodes_key": "#2#verticalSignificanceSurfaceObservations", "value": "const:7"}, - {"eccodes_key": "#3#verticalSignificanceSurfaceObservations", "value": "const:8"}, - {"eccodes_key": "#4#verticalSignificanceSurfaceObservations", "value": "const:9"}, - {"eccodes_key": "#1#cloudType", "value": "data:low_cloud_type"}, - {"eccodes_key": "#2#cloudType", "value": "data:middle_cloud_type"}, - {"eccodes_key": "#3#cloudType", "value": "data:high_cloud_type"}, - {"eccodes_key": "#5#verticalSignificanceSurfaceObservations", "value": "const:7"}, - {"eccodes_key": "#6#verticalSignificanceSurfaceObservations", "value": "const:8"}, - {"eccodes_key": "#7#verticalSignificanceSurfaceObservations", "value": "const:9"}, - {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction"}, - {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction"}, - {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction"}, - {"eccodes_key": "#4#cloudType", "value": "data:e_cloud_genus"}, - {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:e_cloud_direction"}, - {"eccodes_key": "#1#elevation", "value": "data:e_cloud_elevation"}, - {"eccodes_key": "#1#presentWeather", "value": "data:present_weather"}, + {"eccodes_key": "#1#stationType", "value": "data:WMO_station_type", "valid_min": "const:0", "valid_max": "const:3"}, + {"eccodes_key": "#1#year", "value": "data:year", "valid_min": "const:0", "valid_max": "const:4095"}, + {"eccodes_key": "#1#month", "value": "data:month", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#day", "value": "data:day", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#hour", "value": "data:hour", "valid_min": "const:0", "valid_max": "const:31"}, + {"eccodes_key": "#1#minute", "value": "data:minute", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#nonCoordinateGeopotentialHeight", "value": "data:geopotential_height", "valid_min": "const:-1000", "valid_max": "const:130071"}, + {"eccodes_key": "#1#3HourPressureChange", "value": "data:3hr_pressure_change", "valid_min": "const:-5000", "valid_max": "const:5230"}, + {"eccodes_key": "#1#characteristicOfPressureTendency", "value": "data:pressure_tendency_characteristic", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#24HourPressureChange", "value": "data:24hr_pressure_change", "valid_min": "const:-10000", "valid_max": "const:10470"}, + {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity", "valid_min": "const:0", "valid_max": "const:127"}, + {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility", "valid_min": "const:0", "valid_max": "const:81910"}, + {"eccodes_key": "#1#stateOfGround", "value": "data:ground_state", "valid_min": "const:0", "valid_max": "const:31"}, + {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth", "valid_min": "const:-0.02", "valid_max": "const:655.33"}, + {"eccodes_key": "#1#groundMinimumTemperaturePast12Hours", "value": "data:ground_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#cloudCoverTotal", "value": "data:cloud_cover", "valid_min": "const:0", "valid_max": "const:127"}, + {"eccodes_key": "#1#verticalSignificanceSurfaceObservations", "value": "data:cloud_vs_s1", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base", "valid_min": "const:-400", "valid_max": "const:20070"}, + {"eccodes_key": "#2#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#3#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#4#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#cloudType", "value": "data:low_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#2#cloudType", "value": "data:middle_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#3#cloudType", "value": "data:high_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#5#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#6#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#7#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#4#cloudType", "value": "data:e_cloud_genus", "valid_min": "const:0", "valid_max": "const:63"}, + {"eccodes_key": "#1#bearingOrAzimuth", "value": "data:e_cloud_direction", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#elevation", "value": "data:e_cloud_elevation", "valid_min": "const:-90.0", "valid_max": "const:237.67"}, + {"eccodes_key": "#1#presentWeather", "value": "data:present_weather", "valid_min": "const:0", "valid_max": "const:511"}, {"eccodes_key": "#1#timePeriod", "value": "const:-1"}, - {"eccodes_key": "#2#timePeriod", "value": "data:past_weather_time_period"}, - {"eccodes_key": "#1#pastWeather1", "value": "data:past_weather_1"}, - {"eccodes_key": "#1#pastWeather2", "value": "data:past_weather_2"}, + {"eccodes_key": "#2#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#1#pastWeather1", "value": "data:past_weather_1", "valid_min": "const:0", "valid_max": "const:31"}, + {"eccodes_key": "#1#pastWeather2", "value": "data:past_weather_2", "valid_min": "const:0", "valid_max": "const:31"}, {"eccodes_key": "#3#timeSignificance", "value": "const:2"}, {"eccodes_key": "#6#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#windDirection", "value": "data:wind_direction"}, - {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed"}, + {"eccodes_key": "#1#windDirection", "value": "data:wind_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed", "valid_min": "const:0.0", "valid_max": "const:409.5"}, {"eccodes_key": "#7#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1"}, - {"eccodes_key": "#8#timePeriod", "value": "data:past_weather_time_period"}, - {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2"}, - {"eccodes_key": "#13#timePeriod", "value": "data:maximum_temperature_period_start"}, - {"eccodes_key": "#14#timePeriod", "value": "data:maximum_temperature_period_end"}, - {"eccodes_key": "#2#maximumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:maximum_temperature"}, - {"eccodes_key": "#15#timePeriod", "value": "data:minimum_temperature_period_start"}, - {"eccodes_key": "#16#timePeriod", "value": "data:minimum_temperature_period_end"}, - {"eccodes_key": "#3#minimumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:minimum_temperature"}, - {"eccodes_key": "#17#timePeriod", "value": "data:ps1_time_period"}, - {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1"}, - {"eccodes_key": "#18#timePeriod", "value": "data:ps3_time_period"}, - {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3"}, + {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#8#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#13#timePeriod", "value": "data:maximum_temperature_period_start", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#14#timePeriod", "value": "data:maximum_temperature_period_end", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#2#maximumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:maximum_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#15#timePeriod", "value": "data:minimum_temperature_period_start", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#16#timePeriod", "value": "data:minimum_temperature_period_end", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#3#minimumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:minimum_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#17#timePeriod", "value": "data:ps1_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#18#timePeriod", "value": "data:ps3_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, + {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, {"eccodes_key": "#19#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#3#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_24h"}, + {"eccodes_key": "#3#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_24h", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, {"eccodes_key": "#22#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#1#typeOfInstrumentationForEvaporationMeasurement", "value": "data:evaporation_instrument"}, - {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration"}, + {"eccodes_key": "#1#typeOfInstrumentationForEvaporationMeasurement", "value": "data:evaporation_instrument", "valid_min": "const:0", "valid_max": "const:15"}, + {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration", "valid_min": "const:0.0", "valid_max": "const:102.3"}, {"eccodes_key": "#24#timePeriod", "value": "const:-1"}, - {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr"}, + {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr", "valid_min": "const:0", "valid_max": "const:2047"}, {"eccodes_key": "#25#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr"}, + {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr", "valid_min": "const:0", "valid_max": "const:2047"}, {"eccodes_key": "#26#timePeriod", "value": "const:-1"}, - {"eccodes_key": "#1#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_1hr"}, - {"eccodes_key": "#1#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_1hr"}, - {"eccodes_key": "#1#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_1hr"}, - {"eccodes_key": "#1#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_1hr"}, - {"eccodes_key": "#1#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_1hr"}, - {"eccodes_key": "#1#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_1hr"}, + {"eccodes_key": "#1#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_1hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, + {"eccodes_key": "#1#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_1hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, + {"eccodes_key": "#1#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_1hr", "valid_min": "const:-163840000", "valid_max": "const:163830000"}, + {"eccodes_key": "#1#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_1hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#1#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_1hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#1#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_1hr", "valid_min": "const:0", "valid_max": "const:104857500"}, {"eccodes_key": "#27#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#2#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_24hr"}, - {"eccodes_key": "#2#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_24hr"}, - {"eccodes_key": "#2#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_24hr"}, - {"eccodes_key": "#2#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_24hr"}, - {"eccodes_key": "#2#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_24hr"}, - {"eccodes_key": "#2#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_24hr"}, - {"eccodes_key": "#28#timePeriod", "value": "data:past_weather_time_period"}, + {"eccodes_key": "#2#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_24hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, + {"eccodes_key": "#2#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_24hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, + {"eccodes_key": "#2#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_24hr", "valid_min": "const:-163840000", "valid_max": "const:163830000"}, + {"eccodes_key": "#2#globalSolarRadiationIntegratedOverPeriodSpecified", "value": "data:global_solar_radiation_24hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#2#diffuseSolarRadiationIntegratedOverPeriodSpecified", "value": "data:diffuse_solar_radiation_24hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#2#directSolarRadiationIntegratedOverPeriodSpecified", "value": "data:direct_solar_radiation_24hr", "valid_min": "const:0", "valid_max": "const:104857500"}, + {"eccodes_key": "#28#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048","valid_max": "const:2047"}, {"eccodes_key": "#29#timePeriod", "value": "const:0"}, - {"eccodes_key": "#1#temperatureChangeOverSpecifiedPeriod", "value": "data:temperature_change"} + {"eccodes_key": "#1#temperatureChangeOverSpecifiedPeriod", "value": "data:temperature_change", "valid_min": "const:-30", "valid_max": "const:33"} ] } \ No newline at end of file From b3c9aa3b08cbda7593e429893cb31e807acd1494 Mon Sep 17 00:00:00 2001 From: RoryPTB <47696929+RoryPTB@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:51:27 +0200 Subject: [PATCH 5/7] Updated pytest --- Dockerfile | 4 ++-- synop2bufr/__init__.py | 24 ++++++++++++------------ tests/test_synop2bufr.py | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5de038..ffd1069 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,8 @@ RUN echo "Acquire::Check-Valid-Until \"false\";\nAcquire::Check-Date \"false\";" && apt-get update -y \ && apt-get install -y ${DEBIAN_PACKAGES} \ && apt-get install -y python3 python3-pip libeccodes-tools \ - && pip3 install --no-cache-dir https://github.com/wmo-im/csv2bufr/archive/refs/tags/v0.6.3.zip \ - && pip3 install --no-cache-dir https://github.com/wmo-im/pymetdecoder/archive/refs/tags/v0.1.9.zip + && pip3 install --no-cache-dir https://github.com/wmo-im/csv2bufr/archive/refs/tags/v0.7.1.zip \ + && pip3 install --no-cache-dir https://github.com/wmo-im/pymetdecoder/archive/refs/tags/v0.1.10.zip ENV LOG_LEVEL=INFO diff --git a/synop2bufr/__init__.py b/synop2bufr/__init__.py index 58b8038..18fd497 100644 --- a/synop2bufr/__init__.py +++ b/synop2bufr/__init__.py @@ -33,12 +33,13 @@ from pymetdecoder import synop from csv2bufr import BUFRMessage -__version__ = '0.5.1' +__version__ = '0.5.dev2' LOGGER = logging.getLogger(__name__) -# Global array to store warnings +# Global arrays to store warnings and errors warning_msgs = [] +error_msgs = [] # ! Configure the pymetdecoder/csv2bufr loggers to append warnings to the array @@ -1195,9 +1196,6 @@ def extract_individual_synop(data: str) -> list: # Start position is -1 if AAXX is not present in the message if start_position == -1: - # LOGGER.error( - # "Invalid SYNOP message: AAXX could not be found." - # ) raise ValueError( "Invalid SYNOP message: AAXX could not be found." ) @@ -1255,11 +1253,9 @@ def transform(data: str, metadata: str, year: int, :returns: iterator """ - # Array to store error messages - error_msgs = [] - - # Make warning messages array global + # Make warning and error messages array global global warning_msgs + global error_msgs # =================== # First parse metadata file @@ -1286,7 +1282,7 @@ def transform(data: str, metadata: str, year: int, tsi_mapping[tsi] = wsi except Exception as e: LOGGER.error(e) - error_msgs.append(e) + error_msgs.append(str(e)) fh.close() # metadata = metadata_dict[wsi] @@ -1468,7 +1464,7 @@ def transform(data: str, metadata: str, year: int, mapping.update(s4_mappings[i] for i in range(4)) except Exception: LOGGER.error(f"Missing station height for station {tsi}") - warning_msgs.append( + error_msgs.append( f"Missing station height for station {tsi}") # At this point we have a dictionary for the data, a @@ -1492,6 +1488,7 @@ def transform(data: str, metadata: str, year: int, except Exception as e: LOGGER.error(e) LOGGER.error("Error creating BUFRMessage") + error_msgs.append(str(e)) error_msgs.append("Error creating BUFRMessage") conversion_success[tsi] = False @@ -1503,6 +1500,7 @@ def transform(data: str, metadata: str, year: int, except Exception as e: LOGGER.error(e) LOGGER.error("Error parsing message") + error_msgs.append(str(e)) error_msgs.append("Error parsing message") conversion_success[tsi] = False @@ -1538,6 +1536,7 @@ def transform(data: str, metadata: str, year: int, LOGGER.error("Error encoding BUFR, null returned") error_msgs.append("Error encoding BUFR, null returned") LOGGER.error(e) + error_msgs.append(str(e)) result["bufr4"] = None status = { "code": FAILED, @@ -1576,8 +1575,9 @@ def transform(data: str, metadata: str, year: int, # now yield result back to caller yield result - # Reset warning messages array for next iteration + # Reset warning and error messages array for next iteration warning_msgs = [] + error_msgs = [] # Output conversion status to user if conversion_success[tsi]: diff --git a/tests/test_synop2bufr.py b/tests/test_synop2bufr.py index 37d5479..466a6e3 100644 --- a/tests/test_synop2bufr.py +++ b/tests/test_synop2bufr.py @@ -149,9 +149,9 @@ def test_bufr_307080(multiple_reports_307080, metadata_string): for item in result: msgs[item['_meta']['id']] = item # Test the md5 keys - assert msgs['WIGOS_0-20000-0-15015_20220321T120000']['_meta']['properties']['md5'] == '603e1c2c25591a8d4213f339a1ce3b52' # noqa - assert msgs['WIGOS_0-20000-0-15020_20220321T120000']['_meta']['properties']['md5'] == '320ad7f1c3f7940a3059ca04dbb6d74a' # noqa - assert msgs['WIGOS_0-20000-0-15090_20220321T120000']['_meta']['properties']['md5'] == '3215ebdc66707c46458d2bbacb49427e' # noqa + assert msgs['WIGOS_0-20000-0-15015_20220321T120000']['_meta']['properties']['md5'] == 'f1595e9f82880b650de227fa007eb770' # noqa + assert msgs['WIGOS_0-20000-0-15020_20220321T120000']['_meta']['properties']['md5'] == '21cd8741f8615cc7b0df70060c3a98ff' # noqa + assert msgs['WIGOS_0-20000-0-15090_20220321T120000']['_meta']['properties']['md5'] == 'f0b736dba245b34985f757b0597e3d54' # noqa # Test the bufr template used for all the reports # (they should be the same for every report) From 732602b6a90e21a0934d81383e72f2585c5e225d Mon Sep 17 00:00:00 2001 From: RoryPTB <47696929+RoryPTB@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:23:04 +0200 Subject: [PATCH 6/7] Tightened mapping ranges and added pytests --- synop2bufr/__init__.py | 23 ++++++++- .../resources/synop-mappings-307080.json | 48 +++++++++---------- .../resources/synop-mappings-307096.json | 48 +++++++++---------- tests/test_synop2bufr.py | 32 ++++++++++++- 4 files changed, 99 insertions(+), 52 deletions(-) diff --git a/synop2bufr/__init__.py b/synop2bufr/__init__.py index 18fd497..b3be619 100644 --- a/synop2bufr/__init__.py +++ b/synop2bufr/__init__.py @@ -336,6 +336,23 @@ def parse_synop(message: str, year: int, month: int) -> dict: except Exception: output['dewpoint_temperature'] = None + # Verify that the dewpoint temperature is less than or equal to + # the air temperature + if ((output.get('air_temperature') is not None) and + (output.get('dewpoint_temperature') is not None)): + + A = output['air_temperature'] + D = output['dewpoint_temperature'] + + # If the dewpoint temperature is higher than the air temperature, + # log a warning and set both values to None + if A < D: + LOGGER.warning(f"Reported dewpoint temperature {D} is greater than the reported air temperature {A}. Elements set to missing") # noqa + warning_msgs.append(f"Reported dewpoint temperature {D} is greater than the reported air temperature {A}. Elements set to missing") # noqa + + output['air_temperature'] = None + output['dewpoint_temperature'] = None + # RH is already given in % if decoded.get('relative_humidity') is not None: try: @@ -1420,7 +1437,8 @@ def transform(data: str, metadata: str, year: int, ), "value": f"data:vs_s3_{idx+1}"}, {"eccodes_key": f"#{idx+3}#cloudAmount", - "value": f"data:cloud_amount_s3_{idx+1}"}, + "value": f"data:cloud_amount_s3_{idx+1}", + "valid_min": "const:0", "valid_max": "const:8"}, {"eccodes_key": f"#{idx+5}#cloudType", "value": f"data:cloud_genus_s3_{idx+1}"}, {"eccodes_key": f"#{idx+2}#heightOfBaseOfCloud", @@ -1453,7 +1471,8 @@ def transform(data: str, metadata: str, year: int, ), "value": f"const:{vs_s4}"}, {"eccodes_key": f"#{idx+num_s3_clouds+3}#cloudAmount", - "value": f"data:cloud_amount_s4_{idx+1}"}, + "value": f"data:cloud_amount_s4_{idx+1}", + "valid_min": "const:0", "valid_max": "const:8"}, {"eccodes_key": f"#{idx+num_s3_clouds+5}#cloudType", "value": f"data:cloud_genus_s4_{idx+1}"}, {"eccodes_key": f"#{idx+1}#heightOfTopOfCloud", diff --git a/synop2bufr/resources/synop-mappings-307080.json b/synop2bufr/resources/synop-mappings-307080.json index 6cc9c69..c498366 100644 --- a/synop2bufr/resources/synop-mappings-307080.json +++ b/synop2bufr/resources/synop-mappings-307080.json @@ -42,49 +42,49 @@ {"eccodes_key": "#1#day", "value": "data:day", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#1#hour", "value": "data:hour", "valid_min": "const:0", "valid_max": "const:31"}, {"eccodes_key": "#1#minute", "value": "data:minute", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, - {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure", "valid_min": "const:50000", "valid_max": "const:108000"}, + {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure", "valid_min": "const:50000", "valid_max": "const:108000"}, {"eccodes_key": "#1#3HourPressureChange", "value": "data:3hr_pressure_change", "valid_min": "const:-5000", "valid_max": "const:5230"}, {"eccodes_key": "#1#characteristicOfPressureTendency", "value": "data:pressure_tendency_characteristic", "valid_min": "const:0", "valid_max": "const:15"}, {"eccodes_key": "#1#24HourPressureChange", "value": "data:24hr_pressure_change", "valid_min": "const:-10000", "valid_max": "const:10470"}, - {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface", "valid_min": "const:50000", "valid_max": "const:108000"}, {"eccodes_key": "#1#nonCoordinateGeopotentialHeight", "value": "data:geopotential_height", "valid_min": "const:-1000", "valid_max": "const:130071"}, - {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, - {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, - {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity", "valid_min": "const:0", "valid_max": "const:127"}, - {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility", "valid_min": "const:0", "valid_max": "const:81910"}, - {"eccodes_key": "#1#totalPrecipitationPast24Hours", "value": "data:precipitation_24h","valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature", "valid_min": "const:193.15", "valid_max": "const:333.15"}, + {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature", "valid_min": "const:193.15", "valid_max": "const:308.15"}, + {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity", "valid_min": "const:0", "valid_max": "const:100"}, + {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility", "valid_min": "const:10", "valid_max": "const:81910"}, + {"eccodes_key": "#1#totalPrecipitationPast24Hours", "value": "data:precipitation_24h","valid_min": "const:0.0", "valid_max": "const:500"}, {"eccodes_key": "#1#cloudCoverTotal", "value": "data:cloud_cover", "valid_min": "const:0", "valid_max": "const:127"}, {"eccodes_key": "#1#verticalSignificanceSurfaceObservations", "value": "data:cloud_vs_s1", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1", "valid_min": "const:0", "valid_max": "const:15"}, - {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base", "valid_min": "const:-400", "valid_max": "const:20070"}, + {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1", "valid_min": "const:0", "valid_max": "const:8"}, + {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base", "valid_min": "const:0.0", "valid_max": "const:20070"}, {"eccodes_key": "#1#cloudType", "value": "data:low_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#2#cloudType", "value": "data:middle_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#3#cloudType", "value": "data:high_cloud_type", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#2#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#3#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#4#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, - {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, - {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, + {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, + {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, {"eccodes_key": "#5#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#6#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#7#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#1#stateOfGround", "value": "data:ground_state", "valid_min": "const:0", "valid_max": "const:31"}, - {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth", "valid_min": "const:-0.02", "valid_max": "const:655.33"}, + {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth", "valid_min": "const:0.0", "valid_max": "const:25"}, {"eccodes_key": "#1#groundMinimumTemperaturePast12Hours", "value": "data:ground_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, {"eccodes_key": "#1#presentWeather", "value": "data:present_weather", "valid_min": "const:0", "valid_max": "const:511"}, {"eccodes_key": "#1#pastWeather1", "value": "data:past_weather_1", "valid_min": "const:0", "valid_max": "const:31"}, {"eccodes_key": "#1#pastWeather2", "value": "data:past_weather_2", "valid_min": "const:0", "valid_max": "const:31"}, {"eccodes_key": "#1#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, {"eccodes_key": "#2#timePeriod", "value": "const:-1", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr", "valid_min": "const:0", "valid_max": "const:2047"}, + {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr", "valid_min": "const:0", "valid_max": "const:60"}, {"eccodes_key": "#3#timePeriod", "value": "const:-24", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr", "valid_min": "const:0", "valid_max": "const:2047"}, + {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr", "valid_min": "const:0", "valid_max": "const:1440"}, {"eccodes_key": "#4#timePeriod", "value": "data:ps1_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1", "valid_min": "const:0.0", "valid_max": "const:500"}, {"eccodes_key": "#5#timePeriod", "value": "data:ps3_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3", "valid_min": "const:0.0", "valid_max": "const:500"}, {"eccodes_key": "#6#timePeriod", "value": "data:maximum_temperature_period_start", "valid_min": "const:-2048", "valid_max": "const:2047"}, {"eccodes_key": "#7#timePeriod", "value": "data:maximum_temperature_period_end", "valid_min": "const:-2048", "valid_max": "const:2047"}, {"eccodes_key": "#1#maximumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:maximum_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, @@ -94,17 +94,17 @@ {"eccodes_key": "#1#instrumentationForWindMeasurement", "value": "data:wind_indicator", "valid_min": "const:0", "valid_max": "const:15"}, {"eccodes_key": "#1#timeSignificance", "value": "const:2"}, {"eccodes_key": "#10#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#windDirection", "value": "data:wind_direction", "valid_min": "const:0", "valid_max": "const:511"}, - {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#1#windDirection", "value": "data:wind_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, + {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed", "valid_min": "const:0.0", "valid_max": "const:75"}, {"eccodes_key": "#11#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1", "valid_min": "const:0.0", "valid_max": "const:150"}, {"eccodes_key": "#12#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2", "valid_min": "const:0.0", "valid_max": "const:150"}, {"eccodes_key": "#13#timePeriod", "value": "const:-24"}, {"eccodes_key": "#1#typeOfInstrumentationForEvaporationMeasurement", "value": "data:evaporation_instrument", "valid_min": "const:0", "valid_max": "const:15"}, - {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration", "valid_min": "const:0.0", "valid_max": "const:102.3"}, + {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration", "valid_min": "const:0.0", "valid_max": "const:100"}, {"eccodes_key": "#4#cloudType", "value": "data:e_cloud_genus", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#bearingOrAzimuth", "value": "data:e_cloud_direction", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#bearingOrAzimuth", "value": "data:e_cloud_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, {"eccodes_key": "#1#elevation", "value": "data:e_cloud_elevation", "valid_min": "const:-90.0", "valid_max": "const:237.67"}, {"eccodes_key": "#14#timePeriod", "value": "const:-1"}, {"eccodes_key": "#1#netRadiationIntegratedOverPeriodSpecified", "value": "data:net_radiation_1hr", "valid_min": "const:-163840000", "valid_max": "const:163830000"}, diff --git a/synop2bufr/resources/synop-mappings-307096.json b/synop2bufr/resources/synop-mappings-307096.json index d9b6e72..33b6c1b 100644 --- a/synop2bufr/resources/synop-mappings-307096.json +++ b/synop2bufr/resources/synop-mappings-307096.json @@ -42,24 +42,24 @@ {"eccodes_key": "#1#day", "value": "data:day", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#1#hour", "value": "data:hour", "valid_min": "const:0", "valid_max": "const:31"}, {"eccodes_key": "#1#minute", "value": "data:minute", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, - {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure", "valid_min": "const:0", "valid_max": "const:163830"}, - {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface", "valid_min": "const:0", "valid_max": "const:163830"}, + {"eccodes_key": "#1#nonCoordinatePressure", "value": "data:station_pressure", "valid_min": "const:50000", "valid_max": "const:108000"}, + {"eccodes_key": "#1#pressureReducedToMeanSeaLevel", "value": "data:sea_level_pressure", "valid_min": "const:50000", "valid_max": "const:108000"}, + {"eccodes_key": "#1#pressure", "value": "data:isobaric_surface", "valid_min": "const:50000", "valid_max": "const:108000"}, {"eccodes_key": "#1#nonCoordinateGeopotentialHeight", "value": "data:geopotential_height", "valid_min": "const:-1000", "valid_max": "const:130071"}, {"eccodes_key": "#1#3HourPressureChange", "value": "data:3hr_pressure_change", "valid_min": "const:-5000", "valid_max": "const:5230"}, {"eccodes_key": "#1#characteristicOfPressureTendency", "value": "data:pressure_tendency_characteristic", "valid_min": "const:0", "valid_max": "const:15"}, {"eccodes_key": "#1#24HourPressureChange", "value": "data:24hr_pressure_change", "valid_min": "const:-10000", "valid_max": "const:10470"}, - {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, - {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, - {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity", "valid_min": "const:0", "valid_max": "const:127"}, - {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility", "valid_min": "const:0", "valid_max": "const:81910"}, + {"eccodes_key": "#1#airTemperature", "value": "data:air_temperature", "valid_min": "const:193.15", "valid_max": "const:333.15"}, + {"eccodes_key": "#1#dewpointTemperature", "value": "data:dewpoint_temperature", "valid_min": "const:193.15", "valid_max": "const:308.15"}, + {"eccodes_key": "#1#relativeHumidity", "value": "data:relative_humidity", "valid_min": "const:0", "valid_max": "const:100"}, + {"eccodes_key": "#1#horizontalVisibility", "value": "data:visibility", "valid_min": "const:10", "valid_max": "const:81910"}, {"eccodes_key": "#1#stateOfGround", "value": "data:ground_state", "valid_min": "const:0", "valid_max": "const:31"}, - {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth", "valid_min": "const:-0.02", "valid_max": "const:655.33"}, + {"eccodes_key": "#1#totalSnowDepth", "value": "data:snow_depth", "valid_min": "const:0.0", "valid_max": "const:25"}, {"eccodes_key": "#1#groundMinimumTemperaturePast12Hours", "value": "data:ground_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, {"eccodes_key": "#1#cloudCoverTotal", "value": "data:cloud_cover", "valid_min": "const:0", "valid_max": "const:127"}, {"eccodes_key": "#1#verticalSignificanceSurfaceObservations", "value": "data:cloud_vs_s1", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1", "valid_min": "const:0", "valid_max": "const:15"}, - {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base", "valid_min": "const:-400", "valid_max": "const:20070"}, + {"eccodes_key": "#1#cloudAmount", "value": "data:cloud_amount_s1", "valid_min": "const:0", "valid_max": "const:8"}, + {"eccodes_key": "#1#heightOfBaseOfCloud", "value": "data:lowest_cloud_base", "valid_min": "const:0", "valid_max": "const:20070"}, {"eccodes_key": "#2#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#3#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#4#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, @@ -69,11 +69,11 @@ {"eccodes_key": "#5#verticalSignificanceSurfaceObservations", "value": "const:7", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#6#verticalSignificanceSurfaceObservations", "value": "const:8", "valid_min": "const:0", "valid_max": "const:63"}, {"eccodes_key": "#7#verticalSignificanceSurfaceObservations", "value": "const:9", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, - {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, - {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction", "valid_min": "const:0", "valid_max": "const:511"}, + {"eccodes_key": "#1#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:low_cloud_drift_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, + {"eccodes_key": "#2#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:middle_cloud_drift_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, + {"eccodes_key": "#3#trueDirectionFromWhichAPhenomenonOrCloudsAreMovingOrInWhichTheyAreObserved", "value": "data:high_cloud_drift_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, {"eccodes_key": "#4#cloudType", "value": "data:e_cloud_genus", "valid_min": "const:0", "valid_max": "const:63"}, - {"eccodes_key": "#1#bearingOrAzimuth", "value": "data:e_cloud_direction", "valid_min": "const:0.0", "valid_max": "const:655.35"}, + {"eccodes_key": "#1#bearingOrAzimuth", "value": "data:e_cloud_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, {"eccodes_key": "#1#elevation", "value": "data:e_cloud_elevation", "valid_min": "const:-90.0", "valid_max": "const:237.67"}, {"eccodes_key": "#1#presentWeather", "value": "data:present_weather", "valid_min": "const:0", "valid_max": "const:511"}, {"eccodes_key": "#1#timePeriod", "value": "const:-1"}, @@ -82,12 +82,12 @@ {"eccodes_key": "#1#pastWeather2", "value": "data:past_weather_2", "valid_min": "const:0", "valid_max": "const:31"}, {"eccodes_key": "#3#timeSignificance", "value": "const:2"}, {"eccodes_key": "#6#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#windDirection", "value": "data:wind_direction", "valid_min": "const:0", "valid_max": "const:511"}, - {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#1#windDirection", "value": "data:wind_direction", "valid_min": "const:0.0", "valid_max": "const:360"}, + {"eccodes_key": "#1#windSpeed", "value": "data:wind_speed", "valid_min": "const:0.0", "valid_max": "const:75"}, {"eccodes_key": "#7#timePeriod", "value": "const:-10"}, - {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#1#maximumWindGustSpeed", "value": "data:highest_gust_1", "valid_min": "const:0.0", "valid_max": "const:150"}, {"eccodes_key": "#8#timePeriod", "value": "data:past_weather_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2", "valid_min": "const:0.0", "valid_max": "const:409.5"}, + {"eccodes_key": "#2#maximumWindGustSpeed", "value": "data:highest_gust_2", "valid_min": "const:0.0", "valid_max": "const:150"}, {"eccodes_key": "#13#timePeriod", "value": "data:maximum_temperature_period_start", "valid_min": "const:-2048", "valid_max": "const:2047"}, {"eccodes_key": "#14#timePeriod", "value": "data:maximum_temperature_period_end", "valid_min": "const:-2048", "valid_max": "const:2047"}, {"eccodes_key": "#2#maximumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:maximum_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, @@ -95,18 +95,18 @@ {"eccodes_key": "#16#timePeriod", "value": "data:minimum_temperature_period_end", "valid_min": "const:-2048", "valid_max": "const:2047"}, {"eccodes_key": "#3#minimumTemperatureAtHeightAndOverPeriodSpecified", "value": "data:minimum_temperature", "valid_min": "const:0.0", "valid_max": "const:655.35"}, {"eccodes_key": "#17#timePeriod", "value": "data:ps1_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#1#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s1", "valid_min": "const:0.0", "valid_max": "const:500"}, {"eccodes_key": "#18#timePeriod", "value": "data:ps3_time_period", "valid_min": "const:-2048", "valid_max": "const:2047"}, - {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#2#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_s3", "valid_min": "const:0.0", "valid_max": "const:500"}, {"eccodes_key": "#19#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#3#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_24h", "valid_min": "const:-0.1", "valid_max": "const:1638.2"}, + {"eccodes_key": "#3#totalPrecipitationOrTotalWaterEquivalent", "value": "data:precipitation_24h", "valid_min": "const:0.0", "valid_max": "const:500"}, {"eccodes_key": "#22#timePeriod", "value": "const:-24"}, {"eccodes_key": "#1#typeOfInstrumentationForEvaporationMeasurement", "value": "data:evaporation_instrument", "valid_min": "const:0", "valid_max": "const:15"}, - {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration", "valid_min": "const:0.0", "valid_max": "const:102.3"}, + {"eccodes_key": "#1#evaporation", "value": "data:evapotranspiration", "valid_min": "const:0.0", "valid_max": "const:100"}, {"eccodes_key": "#24#timePeriod", "value": "const:-1"}, - {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr", "valid_min": "const:0", "valid_max": "const:2047"}, + {"eccodes_key": "#1#totalSunshine", "value": "data:sunshine_amount_1hr", "valid_min": "const:0", "valid_max": "const:60"}, {"eccodes_key": "#25#timePeriod", "value": "const:-24"}, - {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr", "valid_min": "const:0", "valid_max": "const:2047"}, + {"eccodes_key": "#2#totalSunshine", "value": "data:sunshine_amount_24hr", "valid_min": "const:0", "valid_max": "const:1440"}, {"eccodes_key": "#26#timePeriod", "value": "const:-1"}, {"eccodes_key": "#1#longWaveRadiationIntegratedOverPeriodSpecified", "value": "data:long_wave_radiation_1hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, {"eccodes_key": "#1#shortWaveRadiationIntegratedOverPeriodSpecified", "value": "data:short_wave_radiation_1hr", "valid_min": "const:-65536000", "valid_max": "const:65535000"}, diff --git a/tests/test_synop2bufr.py b/tests/test_synop2bufr.py index 466a6e3..b92d705 100644 --- a/tests/test_synop2bufr.py +++ b/tests/test_synop2bufr.py @@ -221,7 +221,7 @@ def test_no_time(): with pytest.raises(Exception) as e: # Attempt to decode the message - parse_synop(missing_time) + parse_synop(missing_time, 2000, 1) assert str( e.value) == ("No SYNOP reports were extracted." " Perhaps the date group YYGGiw" @@ -236,9 +236,37 @@ def test_no_tsi(): with pytest.raises(Exception) as e: # Attempt to decode the message - parse_synop(missing_tsi) + parse_synop(missing_tsi, 2000, 1) assert str( e.value) == ("Unexpected precipitation group" " found in section 1, thus unable to" " decode. Section 0 groups may be" " missing.") + + +def test_dewpoint_qc(caplog): + + invalid_dewpoint = """AAXX 21121 + 15015 05515 32931 10103 20111 39765 42250 57020 60071""" + + parse_synop(invalid_dewpoint, 2000, 1) + + # Check that the warning message is correct + assert "Reported dewpoint temperature 284.25 is greater than the reported air temperature 283.45. Elements set to missing" in caplog.text # noqa + + +def test_range_qc(metadata_string): + + out_of_range = """AAXX 21121 + 15015 05515 32980 10610 21810 34765 42250 57020 66001=""" + + result = transform(out_of_range, metadata_string, 2000, 1) + + for item in result: + warning_msgs = item["warnings"] + + assert "#1#nonCoordinatePressure: Value (47650.0) out of valid range (50000 - 108000).; Element set to missing" in warning_msgs # noqa + assert "#1#airTemperature: Value (334.15) out of valid range (193.15 - 333.15).; Element set to missing" in warning_msgs # noqa + assert "#1#dewpointTemperature: Value (192.15) out of valid range (193.15 - 308.15).; Element set to missing" in warning_msgs # noqa + assert "#1#windSpeed: Value (80.0) out of valid range (0.0 - 75).; Element set to missing" in warning_msgs # noqa + assert "#1#totalPrecipitationOrTotalWaterEquivalent: Value (600.0) out of valid range (0.0 - 500).; Element set to missing" in warning_msgs # noqa From 68292bdd5b75b12b6deb6522d5df8d5d5b52d4d0 Mon Sep 17 00:00:00 2001 From: RoryPTB <47696929+RoryPTB@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:47:43 +0200 Subject: [PATCH 7/7] No BUFR file written for NIL report + updated test metadata + bug fix --- data/gts_data/station_list.csv | 136 ++++++++++++------------ data/wis2box_data/station_list.csv | 160 ++++++++++++++--------------- synop2bufr/__init__.py | 23 ++++- 3 files changed, 167 insertions(+), 152 deletions(-) diff --git a/data/gts_data/station_list.csv b/data/gts_data/station_list.csv index 2713dd4..a53ca86 100644 --- a/data/gts_data/station_list.csv +++ b/data/gts_data/station_list.csv @@ -1,69 +1,69 @@ station_name,wigos_station_identifier,traditional_station_identifier,facility_type,latitude,longitude,elevation,barometer_height,territory_name -"CABO SAN ANTONIO, PINAR DEL RIO",0-20000-0-78310,78310,Land (fixed),21.86666667,84.95,,,Cuba -PINAR DEL RIO,0-20000-0-78315,78315,Land (fixed),22.41666667,83.68333333,,,Cuba -"BAHIA HONDA, PINAR DEL RIO",0-20000-0-78318,78318,Land (fixed),22.91666667,83.16666667,,,Cuba -"BATABANO, LA HABANA",0-20000-0-78322,78322,Land (fixed),22.71666667,82.28333333,,,Cuba -"PUNTA DEL ESTE, ISLA DE LA JUVENTUD",0-20000-0-78324,78324,Land (fixed),21.55,82.53333333,,,Cuba -"CASA BLANCA, LA HABANA",0-20000-0-78325,78325,Land (fixed),23.16666667,82.35,,,Cuba -VARADERO,0-20000-0-78328,78328,Land (fixed),23.25,81.41666667,,,Cuba -"PLAYA GIRON, MATANZAS",0-20000-0-78333,78333,Land (fixed),22.06666667,81.03333333,,,Cuba -"CANTARRANA, CIENFUEGOS",0-20000-0-78344,78344,Land (fixed),21.91666667,80.16666667,,,Cuba -"JUCARO, CIEGO DE AVILA",0-20000-0-78345,78345,Land (fixed),21.61666667,78.85,,,Cuba -"CAIBARIEN, VILLA CLARA",0-20000-0-78348,78348,Land (fixed),22.51666667,79.45,,,Cuba -"SANCTI SPIRITUS, SANCTI SPIRITUS",0-20000-0-78349,78349,Land (fixed),21.93333333,79.45,,,Cuba -"SANTA CRUZ DEL SUR, CAMAGUEY",0-20000-0-78351,78351,Land (fixed),20.71666667,78,,,Cuba -"NUEVITAS, CAMAGUEY",0-20000-0-78353,78353,Land (fixed),21.53333333,77.25,,,Cuba -CAMAGUEY,0-20000-0-78355,78355,Land (fixed),21.4,77.85,,,Cuba -"PUERTO PADRE, LAS TUNAS",0-20000-0-78358,78358,Land (fixed),21.2,76.61666667,,,Cuba -"CABO CRUZ, GRANMA",0-20000-0-78360,78360,Land (fixed),19.85,77.23333333,,,Cuba -"CONTRAMAESTRE, SANTIAGO DE CUBA",0-20000-0-78363,78363,Land (fixed),20.28333333,76.25,,,Cuba -"PUNTA LUCRECIA, HOLGUIN",0-20000-0-78365,78365,Land (fixed),21.06666667,75.61666667,,,Cuba -"PUNTA DE MAISI, GUANTANAMO",0-20000-0-78369,78369,Land (fixed),20.25,74.15,,,Cuba -X,0-20000-0-78308,78308,Land (fixed),0,0,,,Cuba -X,0-20000-0-78309,78309,Land (fixed),0,0,,,Cuba -"SANTA LUCIA, PINAR DEL RIO",0-20000-0-78312,78312,Land (fixed),22.66666667,83.96666667,,,Cuba -"ISABEL RUBIO, PINAR DEL RIO",0-20000-0-78313,78313,Land (fixed),22.16666667,84.1,,,Cuba -"SAN JUAN Y MARTINEZ, PINAR DEL RIO",0-20000-0-78314,78314,Land (fixed),22.28333333,83.83333333,,,Cuba -"LA PALMA, PINAR DEL RIO",0-20000-0-78316,78316,Land (fixed),22.76666667,83.55,,,Cuba -"PASO REAL DE SAN DIEGO, PINAR DEL RIO",0-20000-0-78317,78317,Land (fixed),22.55,83.3,,,Cuba -"ARTEMISA, LA HABANA",0-20000-0-78319,78319,Land (fixed),22.8,82.75,,,Cuba -"GUIRA DE MELENA, LA HABANA",0-20000-0-78320,78320,Land (fixed),22.78333333,82.51666667,,,Cuba -"LA FE, ISLA DE LA JUVENTUD",0-20000-0-78321,78321,Land (fixed),21.73333333,82.76666667,,,Cuba -"GUINES, LA HABANA",0-20000-0-78323,78323,Land (fixed),22.85,82.03333333,,,Cuba -X,0-20000-0-78326,78326,Land (fixed),0,0,,,Cuba -"UNION DE REYES, MATANZAS",0-20000-0-78327,78327,Land (fixed),22.76666667,81.53333333,,,Cuba -"INDIO HATUEY, MATANZAS",0-20000-0-78329,78329,Land (fixed),22.81666667,81,,,Cuba -"JOVELLANOS, MATANZAS",0-20000-0-78330,78330,Land (fixed),22.78333333,81.18333333,,,Cuba -"JAGUEY GRANDE, MATANZAS",0-20000-0-78331,78331,Land (fixed),22.63333333,81.26666667,,,Cuba -"COLON, MATANZAS",0-20000-0-78332,78332,Land (fixed),22.68333333,80.93333333,,,Cuba -X,0-20000-0-78334,78334,Land (fixed),0,0,,,Cuba -"AGUADA DE PASAJEROS, CIENFUEGOS",0-20000-0-78335,78335,Land (fixed),22.38333333,80.85,,,Cuba -"TRINIDAD, SANCTI SPIRITUS",0-20000-0-78337,78337,Land (fixed),21.78333333,79.98333333,,,Cuba -"SAGUA LA GRANDE, VILLA CLARA",0-20000-0-78338,78338,Land (fixed),22.81666667,80.08333333,,,Cuba -"CAYO COCO, CIEGO DE AVILA",0-20000-0-78339,78339,Land (fixed),22.51666667,78.45,,,Cuba -"BAINOA, LA HABANA",0-20000-0-78340,78340,Land (fixed),23.03333333,81.91666667,,,Cuba -"EL JIBARO, SANCTI SPIRITUS",0-20000-0-78341,78341,Land (fixed),21.71666667,79.21666667,,,Cuba -"TOPES DE COLLANTES, SANCTI SPIRITUS",0-20000-0-78342,78342,Land (fixed),21.91666667,80.01666667,,,Cuba -"EL YABU, VILLA CLARA",0-20000-0-78343,78343,Land (fixed),22.43333333,79.98333333,,,Cuba -"VENEZUELA, CIEGO DE AVILA",0-20000-0-78346,78346,Land (fixed),21.78333333,78.78333333,,,Cuba -"CAMILO CIENFUEGOS, CIEGO DE AVILA",0-20000-0-78347,78347,Land (fixed),22.15,78.75,,,Cuba -"FLORIDA, CAMAGUEY",0-20000-0-78350,78350,Land (fixed),21.51666667,78.23333333,,,Cuba -"ESMERALDA, CAMAGUEY",0-20000-0-78352,78352,Land (fixed),21.85,78.11666667,,,Cuba -"PALO SECO, CAMAGUEY",0-20000-0-78354,78354,Land (fixed),21.13333333,77.31666667,,,Cuba -X,0-20000-0-78356,78356,Land (fixed),0,0,,,Cuba -"LAS TUNAS, LAS TUNAS",0-20000-0-78357,78357,Land (fixed),20.95,76.95,,,Cuba -"MANSANILLO, GRANMA",0-20000-0-78359,78359,Land (fixed),20.33333333,77.13333333,,,Cuba -"JUCARITO, GRANMA",0-20000-0-78361,78361,Land (fixed),20.66666667," 76.9000",,,Cuba -"LA JIQUIMA, HOLGUIN",0-20000-0-78362,78362,Land (fixed),20.93333333,76.53333333,,,Cuba -"UNIVERSIDAD, SANTIAGO DE CUBA",0-20000-0-78364,78364,Land (fixed),20.05,75.81666667,,,Cuba -"GRAN PIEDRA, SANTIAGO DE CUBA",0-20000-0-78366,78366,Land (fixed),20.03333333,75.63333333,,,Cuba -"GUANTANAMO, GUANTANAMO",0-20000-0-78368,78368,Land (fixed),20.13333333,75.23333333,,,Cuba -"GUARO, HOLGUIN",0-20000-0-78370,78370,Land (fixed),20.66666667,75.78333333,,,Cuba -"PINARES DE MAYARI, HOLGUIN",0-20000-0-78371,78371,Land (fixed),20.48333333,75.8,,,Cuba -X,0-20000-0-78372,78372,Land (fixed),0,0,,,Cuba -"SANTIAGO DE LAS VEGAS, CIUDAD HABANA",0-20000-0-78373,78373,Land (fixed),22.96666667,82.38333333,,,Cuba -"TAPASTE, LA HABANA",0-20000-0-78374,78374,Land (fixed),23.01666667,82.13333333,,,Cuba -"MELENA DEL SUR, LA HABANA",0-20000-0-78375,78375,Land (fixed),22.76666667,82.13333333,,,Cuba -"BAUTA, LA HABANA",0-20000-0-78376,78376,Land (fixed),22.96666667,22.96666667,,,Cuba -"VEGUITAS, GRANMA",0-20000-0-78377,78377,Land (fixed),20.31666667,76.88333333,,,Cuba -"VELASCO, HOLGUIN",0-20000-0-78378,78378,Land (fixed),21.08333333,76.3,,,Cuba +"CABO SAN ANTONIO, PINAR DEL RIO",0-20000-0-78310,78310,Land (fixed),21.86666667,84.95,1.32,,Cuba +PINAR DEL RIO,0-20000-0-78315,78315,Land (fixed),22.41666667,83.68333333,57.5,,Cuba +"BAHIA HONDA, PINAR DEL RIO",0-20000-0-78318,78318,Land (fixed),22.91666667,83.16666667,1.25,,Cuba +"BATABANO, LA HABANA",0-20000-0-78322,78322,Land (fixed),22.71666667,82.28333333,14.5,,Cuba +"PUNTA DEL ESTE, ISLA DE LA JUVENTUD",0-20000-0-78324,78324,Land (fixed),21.55,82.53333333,7.4,,Cuba +"CASA BLANCA, LA HABANA",0-20000-0-78325,78325,Land (fixed),23.16666667,82.35,48.5,,Cuba +VARADERO,0-20000-0-78328,78328,Land (fixed),23.25,81.41666667,5,,Cuba +"PLAYA GIRON, MATANZAS",0-20000-0-78333,78333,Land (fixed),22.06666667,81.03333333,3.1,,Cuba +"CANTARRANA, CIENFUEGOS",0-20000-0-78344,78344,Land (fixed),21.91666667,80.16666667,0,,Cuba +"JUCARO, CIEGO DE AVILA",0-20000-0-78345,78345,Land (fixed),21.61666667,78.85,0.9,,Cuba +"CAIBARIEN, VILLA CLARA",0-20000-0-78348,78348,Land (fixed),22.51666667,79.45,44.5,,Cuba +"SANCTI SPIRITUS, SANCTI SPIRITUS",0-20000-0-78349,78349,Land (fixed),21.93333333,79.45,95.2,,Cuba +"SANTA CRUZ DEL SUR, CAMAGUEY",0-20000-0-78351,78351,Land (fixed),20.71666667,78,4.8,,Cuba +"NUEVITAS, CAMAGUEY",0-20000-0-78353,78353,Land (fixed),21.53333333,77.25,16.5,,Cuba +CAMAGUEY,0-20000-0-78355,78355,Land (fixed),21.4,77.85,123,,Cuba +"PUERTO PADRE, LAS TUNAS",0-20000-0-78358,78358,Land (fixed),21.2,76.61666667,10.2,,Cuba +"CABO CRUZ, GRANMA",0-20000-0-78360,78360,Land (fixed),19.85,77.23333333,4.9,,Cuba +"CONTRAMAESTRE, SANTIAGO DE CUBA",0-20000-0-78363,78363,Land (fixed),20.28333333,76.25,114.3,,Cuba +"PUNTA LUCRECIA, HOLGUIN",0-20000-0-78365,78365,Land (fixed),21.06666667,75.61666667,0.4,,Cuba +"PUNTA DE MAISI, GUANTANAMO",0-20000-0-78369,78369,Land (fixed),20.25,74.15,9.6,,Cuba +X,0-20000-0-78308,78308,Land (fixed),0,0,231,,Cuba +X,0-20000-0-78309,78309,Land (fixed),0,0,26.2,,Cuba +"SANTA LUCIA, PINAR DEL RIO",0-20000-0-78312,78312,Land (fixed),22.66666667,83.96666667,22.7,,Cuba +"ISABEL RUBIO, PINAR DEL RIO",0-20000-0-78313,78313,Land (fixed),22.16666667,84.1,26.7,,Cuba +"SAN JUAN Y MARTINEZ, PINAR DEL RIO",0-20000-0-78314,78314,Land (fixed),22.28333333,83.83333333,25.4,,Cuba +"LA PALMA, PINAR DEL RIO",0-20000-0-78316,78316,Land (fixed),22.76666667,83.55,40.9,,Cuba +"PASO REAL DE SAN DIEGO, PINAR DEL RIO",0-20000-0-78317,78317,Land (fixed),22.55,83.3,45.2,,Cuba +"ARTEMISA, LA HABANA",0-20000-0-78319,78319,Land (fixed),22.8,82.75,173,,Cuba +"GUIRA DE MELENA, LA HABANA",0-20000-0-78320,78320,Land (fixed),22.78333333,82.51666667,11.3,,Cuba +"LA FE, ISLA DE LA JUVENTUD",0-20000-0-78321,78321,Land (fixed),21.73333333,82.76666667,31.8,,Cuba +"GUINES, LA HABANA",0-20000-0-78323,78323,Land (fixed),22.85,82.03333333,56.1,,Cuba +X,0-192-0-78326,78326,Land (fixed),0,0,44.5,,Cuba +"UNION DE REYES, MATANZAS",0-20000-0-78327,78327,Land (fixed),22.76666667,81.53333333,28.6,,Cuba +"INDIO HATUEY, MATANZAS",0-20000-0-78329,78329,Land (fixed),22.81666667,81,17.6,,Cuba +"JOVELLANOS, MATANZAS",0-20000-0-78330,78330,Land (fixed),22.78333333,81.18333333,25.1,,Cuba +"JAGUEY GRANDE, MATANZAS",0-20000-0-78331,78331,Land (fixed),22.63333333,81.26666667,11.2,,Cuba +"COLON, MATANZAS",0-20000-0-78332,78332,Land (fixed),22.68333333,80.93333333,39.1,,Cuba +"PALENQUE DE YATERAS, GUANTANAMO",0-192-0-78334,78334,Land (fixed),20.3675,74.95638889,438,,Cuba +"AGUADA DE PASAJEROS, CIENFUEGOS",0-20000-0-78335,78335,Land (fixed),22.38333333,80.8258,27.1,,Cuba +"TRINIDAD, SANCTI SPIRITUS",0-20000-0-78337,78337,Land (fixed),21.78333333,79.98333333,21.4,,Cuba +"SAGUA LA GRANDE, VILLA CLARA",0-20000-0-78338,78338,Land (fixed),22.81666667,80.08333333,10.9,,Cuba +"CAYO COCO, CIEGO DE AVILA",0-20000-0-78339,78339,Land (fixed),22.51666667,78.45,3.3,,Cuba +"BAINOA, LA HABANA",0-20000-0-78340,78340,Land (fixed),23.03333333,81.91666667,97.6,,Cuba +"EL JIBARO, SANCTI SPIRITUS",0-20000-0-78341,78341,Land (fixed),21.71666667,79.21666667,30.2,,Cuba +"TOPES DE COLLANTES, SANCTI SPIRITUS",0-20000-0-78342,78342,Land (fixed),21.91666667,80.01666667,759.9,,Cuba +"EL YABU, VILLA CLARA",0-20000-0-78343,78343,Land (fixed),22.43333333,79.98333333,115.3,,Cuba +"VENEZUELA, CIEGO DE AVILA",0-20000-0-78346,78346,Land (fixed),21.78333333,78.78333333,26.4,,Cuba +"CAMILO CIENFUEGOS, CIEGO DE AVILA",0-20000-0-78347,78347,Land (fixed),22.15,78.75,15.9,,Cuba +"FLORIDA, CAMAGUEY",0-20000-0-78350,78350,Land (fixed),21.51666667,78.23333333,57.5,,Cuba +"ESMERALDA, CAMAGUEY",0-20000-0-78352,78352,Land (fixed),21.85,78.11666667,35,,Cuba +"PALO SECO, CAMAGUEY",0-20000-0-78354,78354,Land (fixed),21.13333333,77.31666667,95.5,,Cuba +"JAMAL, GUANTANAMO",0-192-0-78356,78356,Land (fixed),20.2977777,74.44638888,48.3,,Cuba +"LAS TUNAS, LAS TUNAS",0-20000-0-78357,78357,Land (fixed),20.95,76.95,107.3,,Cuba +"MANSANILLO, GRANMA",0-192-0-78359,78359,Land (fixed),20.33333333,77.13333333,0.7,,Cuba +"JUCARITO, GRANMA",0-20000-0-78361,78361,Land (fixed),20.66666667," 76.9000",12.6,,Cuba +"LA JIQUIMA, HOLGUIN",0-20000-0-78362,78362,Land (fixed),20.93333333,76.53333333,112.6,,Cuba +"UNIVERSIDAD, SANTIAGO DE CUBA",0-20000-0-78364,78364,Land (fixed),20.05,75.81666667,0,,Cuba +"GRAN PIEDRA, SANTIAGO DE CUBA",0-20000-0-78366,78366,Land (fixed),20.03333333,75.63333333,998.3,,Cuba +"GUANTANAMO, GUANTANAMO",0-20000-0-78368,78368,Land (fixed),20.13333333,75.23333333,53.4,,Cuba +"GUARO, HOLGUIN",0-20000-0-78370,78370,Land (fixed),20.66666667,75.78333333,18.1,,Cuba +"PINARES DE MAYARI, HOLGUIN",0-20000-0-78371,78371,Land (fixed),20.48333333,75.8,645.4,,Cuba +"PEDAGOGICO, HOLGUIN",0-192-0-78372,78372,Land (fixed),20.885,76.22083333,149.4,,Cuba +"SANTIAGO DE LAS VEGAS, CIUDAD HABANA",0-20000-0-78373,78373,Land (fixed),22.96666667,82.38333333,75.8,,Cuba +"TAPASTE, LA HABANA",0-20000-0-78374,78374,Land (fixed),23.01666667,82.13333333,123.8,,Cuba +"MELENA DEL SUR, LA HABANA",0-20000-0-78375,78375,Land (fixed),22.76666667,82.13333333,22.1,,Cuba +"BAUTA, ARTEMISA",0-20000-0-78376,78376,Land (fixed),22.96666667,82.53777777,67.1,,Cuba +"VEGUITAS, GRANMA",0-20000-0-78377,78377,Land (fixed),20.31666667,76.88333333,20.4,,Cuba +"VELASCO, HOLGUIN",0-20000-0-78378,78378,Land (fixed),21.08333333,76.3,65.7,,Cuba diff --git a/data/wis2box_data/station_list.csv b/data/wis2box_data/station_list.csv index ef8dd50..a4bf8b2 100644 --- a/data/wis2box_data/station_list.csv +++ b/data/wis2box_data/station_list.csv @@ -1,80 +1,80 @@ -station_name,wigos_station_identifier,traditional_station_identifier,facility_type,latitude,longitude,elevation,territory_name,wmo_region -BONIFATI (16337-0),0-20000-0-16337,16337,Land (fixed),39.5847222222,15.8913888889,484,Italy,6 -DECIMOMANNU,0-20000-0-16546,16546,Land (fixed),39.3461111111,8.9675,29,Italy,6 -CAMPOBASSO,0-20000-0-16252,16252,Land (fixed),41.5636111111,14.655,793,Italy,6 -GRAZZANISE,0-20000-0-16253,16253,Land (fixed),41.0605555556,14.0788888889,9.19,Italy,6 -PRATICA DI MARE,0-20000-0-16245,16245,Land (fixed),41.6555555556,12.4480555556,12.3,Italy,6 -ILLIZI,0-20000-0-60640,60640,Land (fixed),26.71916,8.61722,542,Algeria,1 -SKIKDA,0-20000-0-60355,60355,Land (fixed),36.88178,6.93503,2,Algeria,1 -PIAN ROSA,0-20000-0-16052,16052,Land (fixed),45.935,7.7061111111,3480,Italy,6 -PRIZZI,0-20000-0-16434,16434,Land (fixed),37.7227777778,13.4280555556,1034,Italy,6 -DOBBIACO,0-20000-0-16033,16033,Land (fixed),46.73,12.22,1222,Italy,6 -CATANIA SIGONELLA,0-20000-0-16459,16459,Land (fixed),37.4055555556,14.9186111111,24,Italy,6 -BALAKA,0-454-2-AWSBALAKA,AWSBALAKA,Land (fixed),-14.983333,34.966666,618,Malawi,1 -MECHERIA,0-20000-0-60549,60549,Land (fixed),33.54581,-0.23527,1123.2,Algeria,1 -TERMOLI,0-20000-0-16232,16232,Land (fixed),42.0041666667,14.9963888889,16,Italy,6 -VIGNA DI VALLE,0-20000-0-16224,16224,Land (fixed),42.0802777778,12.2113888889,260,Italy,6 -HASSI-MESSAOUD,0-20000-0-60581,60581,Land (fixed),31.65861,6.14138,140,Algeria,1 -DJELFA,0-20000-0-60535,60535,Land (fixed),34.65361,3.28138,1180,Algeria,1 -PAGANELLA,0-20000-0-16022,16022,Land (fixed),46.1597222222,11.0341666667,2125,Italy,6 -MONTE S. ANGELO,0-20000-0-16258,16258,Land (fixed),41.7083333333,15.9477777778,838,Italy,6 -MALOMO,0-454-2-AWSMALOMO,AWSMALOMO,Land (fixed),-13.14202,33.83727,1088,Malawi,1 -TREVICO,0-20000-0-16263,16263,Land (fixed),41.0466666667,15.2327777778,1085,Italy,6 -EL-OUED,0-20000-0-60559,60559,Land (fixed),33.50618,6.78841,63,Algeria,1 -TIMIMOUN,0-20000-0-60607,60607,Land (fixed),29.24412,0.28385,312,Algeria,1 -CONCORDIA,0-20000-0-89625,89625,Land (fixed),-75.1016666667,123.4119444444,3233,Italy,7 -TOUGGOURT,0-20000-0-60555,60555,Land (fixed),33.07011,6.09208,87,Algeria,1 -MONTE SCURO,0-20000-0-16344,16344,Land (fixed),39.3305555556,16.3963888889,1669,Italy,6 -BATNA,0-20000-0-60468,60468,Land (fixed),35.76083,6.31972,821,Algeria,1 -ENNA,0-20000-0-16450,16450,Land (fixed),37.5680555556,14.2797222222,1000,Italy,6 -NAMITAMBO,0-454-2-AWSNAMITAMBO,AWSNAMITAMBO,Land (fixed),-15.84052,35.27428,806,Malawi,1 -TOLEZA,0-454-2-AWSTOLEZA,AWSTOLEZA,Land (fixed),-14.948,34.955,764,Malawi,1 -IN-GUEZZAM,0-20000-0-60690,60690,Land (fixed),19.56388,5.74887,399,Algeria,1 -BRIC DELLA CROCE,0-20000-0-16061,16061,Land (fixed),45.0333333333,7.7316666667,709,Italy,6 -TREVISO/ISTRANA,0-20000-0-16098,16098,Land (fixed),45.6838888889,12.1066666667,42,Italy,6 -KAYEREKERA,0-454-2-AWSKAYEREKERA,AWSKAYEREKERA,Land (fixed),-9.92951,33.67305,848,Malawi,1 -LOBI AWS,0-454-2-AWSLOBI,AWSLOBI,Land (fixed),-14.39528,34.07244,1288,Malawi,1 -CERVIA,0-20000-0-16148,16148,Land (fixed),44.2288888889,12.2919444444,6,Italy,6 -NKHOMA UNIVERSITY,0-454-2-AWSNKHOMA,AWSNKHOMA,Land (fixed),-14.04422,34.10468,1230,Malawi,1 -SAIDA,0-20000-0-60536,60536,Land (fixed),34.89186,0.15774,750,Algeria,1 -PASSO ROLLE,0-20000-0-16021,16021,Land (fixed),46.2977777778,11.7866666667,2004,Italy,6 -AREZZO,0-20000-0-16172,16172,Land (fixed),43.4597222222,11.8455555556,248,Italy,6 -CAPRI,0-20000-0-16294,16294,Land (fixed),40.5577777778,14.2019444444,160,Italy,6 -TARVISIO,0-20000-0-16040,16040,Land (fixed),46.5055555556,13.5861111111,777,Italy,6 -SETIF/AIN ARNAT,0-20000-0-60445,60445,Land (fixed),36.1666666667,5.3166666667,1009,Algeria,1 -JIJEL- ACHOUAT,0-20000-0-60351,60351,Land (fixed),36.79472,5.87722,8,Algeria,1 -MONTE ARGENTARIO,0-20000-0-16168,16168,Land (fixed),42.3869444444,11.1697222222,630.7,Italy,6 -CAPO CARBONARA,0-20000-0-16564,16564,Land (fixed),39.1038888889,9.5136111111,116,Italy,6 -ANNABA,0-20000-0-60360,60360,Land (fixed),36.822222,7.8025,5,Algeria,1 -BENI-ABBES,0-20000-0-60602,60602,Land (fixed),30.12846,-2.14953,510,Algeria,1 -FRONTONE,0-20000-0-16179,16179,Land (fixed),43.5169444444,12.7277777778,570,Italy,6 -FERRARA (16138-0),0-20000-0-16138,16138,Land (fixed),44.8155555556,11.6125,8,Italy,6 -TIARET,0-20000-0-60511,60511,Land (fixed),35.35542,1.46792,977,Algeria,1 -MASCARA-GHRISS,0-20000-0-60507,60507,Land (fixed),35.20666,0.1525,511,Algeria,1 -EL-BAYADH,0-20000-0-60550,60550,Land (fixed),33.71966,1.09484,1361,Algeria,1 -USTICA,0-20000-0-16400,16400,Land (fixed),38.7072222222,13.1772222222,242,Italy,6 -GROSSETO,0-20000-0-16206,16206,Land (fixed),42.7480555556,11.0588888889,5.4,Italy,6 -BENI OUNIF,0-12-0-08BECCN60577,60577,Land (fixed),32.05138,-1.26527,830,Algeria,1 -OCNA SUGATAG,0-20000-0-15015,15015,Land (fixed),47.7770616258,23.9404602638,503,Romania,6 -BOTOSANI,0-20000-0-15020,15020,Land (fixed),47.7356532437,26.6455501701,161,Romania,6 -IASI,0-20000-0-15090,15090,Land (fixed),47.163333333,27.6272222222,74.29,Romania,6 -CEAHLAU TOACA,0-20000-0-15108,15108,Land (fixed),46.9775099973,25.9499399749,1897,Romania,6 -CLUJ-NAPOCA,0-20000-0-15120,15120,Land (fixed),46.7777705044,23.5713052939,410,Romania,6 -BACAU,0-20000-0-15150,15150,Land (fixed),46.5577777778,26.8966666667,174,Romania,6 -MIERCUREA CIUC,0-20000-0-15170,15170,Land (fixed),46.3713166568,25.7726166755,661,Romania,6 -ARAD,0-20000-0-15200,15200,Land (fixed),46.1335163958,21.3536215174,116.59,Romania,6 -DEVA,0-20000-0-15230,15230,Land (fixed),45.8649230138,22.898806236,240,Romania,6 -SIBIU,0-20000-0-15260,15260,Land (fixed),45.79018,24.036245,450,Romania,6 -VARFU OMU,0-20000-0-15280,15280,Land (fixed),45.4457927989,25.456690976,2504,Romania,6 -CARANSEBES,0-20000-0-15292,15292,Land (fixed),45.41667,22.22917,241,Romania,6 -GALATI,0-20000-0-15310,15310,Land (fixed),45.4729181384,28.0323010582,69,Romania,6 -TULCEA,0-20000-0-15335,15335,Land (fixed),45.1905064849,28.8241607619,4.36,Romania,6 -RAMNICU VALCEA,0-20000-0-15346,15346,Land (fixed),45.0888211225,24.3628139123,237,Romania,6 -BUZAU,0-20000-0-15350,15350,Land (fixed),45.1326632857,26.8517319231,97,Romania,6 -SULINA,0-20000-0-15360,15360,Land (fixed),45.1623111,29.7268286,12.69,Romania,6 -DROBETA-TURNU SEVERIN,0-20000-0-15410,15410,Land (fixed),44.6264587019,22.6260737132,77,Romania,6 -BUCURESTI BANEASA,0-20000-0-15420,15420,Land (fixed),44.5104330044,26.0781904077,90,Romania,6 -CRAIOVA,0-20000-0-15450,15450,Land (fixed),44.3101404313,23.8669847441,192,Romania,6 -CALARASI,0-20000-0-15460,15460,Land (fixed),44.2057385289,27.3383080718,18.72,Romania,6 -ROSIORII DE VEDE,0-20000-0-15470,15470,Land (fixed),44.1072133362,24.9787400713,102.15,Romania,6 -CONSTANTA,0-20000-0-15480,15480,Land (fixed),44.2138143888,28.6455646839,12.8,Romania,6 +station_name,wigos_station_identifier,traditional_station_identifier,facility_type,latitude,longitude,elevation,barometer_height,territory_name,wmo_region +BONIFATI (16337-0),0-20000-0-16337,16337,Land (fixed),39.58472222,15.89138889,484,,Italy,6 +DECIMOMANNU,0-20000-0-16546,16546,Land (fixed),39.34611111,8.9675,29,,Italy,6 +CAMPOBASSO,0-20000-0-16252,16252,Land (fixed),41.56361111,14.655,793,,Italy,6 +GRAZZANISE,0-20000-0-16253,16253,Land (fixed),41.06055556,14.07888889,9.19,,Italy,6 +PRATICA DI MARE,0-20000-0-16245,16245,Land (fixed),41.65555556,12.44805556,12.3,,Italy,6 +ILLIZI,0-20000-0-60640,60640,Land (fixed),26.71916,8.61722,542,,Algeria,1 +SKIKDA,0-20000-0-60355,60355,Land (fixed),36.88178,6.93503,2,,Algeria,1 +PIAN ROSA,0-20000-0-16052,16052,Land (fixed),45.935,7.706111111,3480,,Italy,6 +PRIZZI,0-20000-0-16434,16434,Land (fixed),37.72277778,13.42805556,1034,,Italy,6 +DOBBIACO,0-20000-0-16033,16033,Land (fixed),46.73,12.22,1222,,Italy,6 +CATANIA SIGONELLA,0-20000-0-16459,16459,Land (fixed),37.40555556,14.91861111,24,,Italy,6 +BALAKA,0-454-2-AWSBALAKA,AWSBALAKA,Land (fixed),-14.983333,34.966666,618,,Malawi,1 +MECHERIA,0-20000-0-60549,60549,Land (fixed),33.54581,-0.23527,1123.2,,Algeria,1 +TERMOLI,0-20000-0-16232,16232,Land (fixed),42.00416667,14.99638889,16,,Italy,6 +VIGNA DI VALLE,0-20000-0-16224,16224,Land (fixed),42.08027778,12.21138889,260,,Italy,6 +HASSI-MESSAOUD,0-20000-0-60581,60581,Land (fixed),31.65861,6.14138,140,,Algeria,1 +DJELFA,0-20000-0-60535,60535,Land (fixed),34.65361,3.28138,1180,,Algeria,1 +PAGANELLA,0-20000-0-16022,16022,Land (fixed),46.15972222,11.03416667,2125,,Italy,6 +MONTE S. ANGELO,0-20000-0-16258,16258,Land (fixed),41.70833333,15.94777778,838,,Italy,6 +MALOMO,0-454-2-AWSMALOMO,AWSMALOMO,Land (fixed),-13.14202,33.83727,1088,,Malawi,1 +TREVICO,0-20000-0-16263,16263,Land (fixed),41.04666667,15.23277778,1085,,Italy,6 +EL-OUED,0-20000-0-60559,60559,Land (fixed),33.50618,6.78841,63,,Algeria,1 +TIMIMOUN,0-20000-0-60607,60607,Land (fixed),29.24412,0.28385,312,,Algeria,1 +CONCORDIA,0-20000-0-89625,89625,Land (fixed),-75.10166667,123.4119444,3233,,Italy,7 +TOUGGOURT,0-20000-0-60555,60555,Land (fixed),33.07011,6.09208,87,,Algeria,1 +MONTE SCURO,0-20000-0-16344,16344,Land (fixed),39.33055556,16.39638889,1669,,Italy,6 +BATNA,0-20000-0-60468,60468,Land (fixed),35.76083,6.31972,821,,Algeria,1 +ENNA,0-20000-0-16450,16450,Land (fixed),37.56805556,14.27972222,1000,,Italy,6 +NAMITAMBO,0-454-2-AWSNAMITAMBO,AWSNAMITAMBO,Land (fixed),-15.84052,35.27428,806,,Malawi,1 +TOLEZA,0-454-2-AWSTOLEZA,AWSTOLEZA,Land (fixed),-14.948,34.955,764,,Malawi,1 +IN-GUEZZAM,0-20000-0-60690,60690,Land (fixed),19.56388,5.74887,399,,Algeria,1 +BRIC DELLA CROCE,0-20000-0-16061,16061,Land (fixed),45.03333333,7.731666667,709,,Italy,6 +TREVISO/ISTRANA,0-20000-0-16098,16098,Land (fixed),45.68388889,12.10666667,42,,Italy,6 +KAYEREKERA,0-454-2-AWSKAYEREKERA,AWSKAYEREKERA,Land (fixed),-9.92951,33.67305,848,,Malawi,1 +LOBI AWS,0-454-2-AWSLOBI,AWSLOBI,Land (fixed),-14.39528,34.07244,1288,,Malawi,1 +CERVIA,0-20000-0-16148,16148,Land (fixed),44.22888889,12.29194444,6,,Italy,6 +NKHOMA UNIVERSITY,0-454-2-AWSNKHOMA,AWSNKHOMA,Land (fixed),-14.04422,34.10468,1230,,Malawi,1 +SAIDA,0-20000-0-60536,60536,Land (fixed),34.89186,0.15774,750,,Algeria,1 +PASSO ROLLE,0-20000-0-16021,16021,Land (fixed),46.29777778,11.78666667,2004,,Italy,6 +AREZZO,0-20000-0-16172,16172,Land (fixed),43.45972222,11.84555556,248,,Italy,6 +CAPRI,0-20000-0-16294,16294,Land (fixed),40.55777778,14.20194444,160,,Italy,6 +TARVISIO,0-20000-0-16040,16040,Land (fixed),46.50555556,13.58611111,777,,Italy,6 +SETIF/AIN ARNAT,0-20000-0-60445,60445,Land (fixed),36.16666667,5.316666667,1009,,Algeria,1 +JIJEL- ACHOUAT,0-20000-0-60351,60351,Land (fixed),36.79472,5.87722,8,,Algeria,1 +MONTE ARGENTARIO,0-20000-0-16168,16168,Land (fixed),42.38694444,11.16972222,630.7,,Italy,6 +CAPO CARBONARA,0-20000-0-16564,16564,Land (fixed),39.10388889,9.513611111,116,,Italy,6 +ANNABA,0-20000-0-60360,60360,Land (fixed),36.822222,7.8025,5,,Algeria,1 +BENI-ABBES,0-20000-0-60602,60602,Land (fixed),30.12846,-2.14953,510,,Algeria,1 +FRONTONE,0-20000-0-16179,16179,Land (fixed),43.51694444,12.72777778,570,,Italy,6 +FERRARA (16138-0),0-20000-0-16138,16138,Land (fixed),44.81555556,11.6125,8,,Italy,6 +TIARET,0-20000-0-60511,60511,Land (fixed),35.35542,1.46792,977,,Algeria,1 +MASCARA-GHRISS,0-20000-0-60507,60507,Land (fixed),35.20666,0.1525,511,,Algeria,1 +EL-BAYADH,0-20000-0-60550,60550,Land (fixed),33.71966,1.09484,1361,,Algeria,1 +USTICA,0-20000-0-16400,16400,Land (fixed),38.70722222,13.17722222,242,,Italy,6 +GROSSETO,0-20000-0-16206,16206,Land (fixed),42.74805556,11.05888889,5.4,,Italy,6 +BENI OUNIF,0-12-0-08BECCN60577,60577,Land (fixed),32.05138,-1.26527,830,,Algeria,1 +OCNA SUGATAG,0-20000-0-15015,15015,Land (fixed),47.77706163,23.94046026,503,,Romania,6 +BOTOSANI,0-20000-0-15020,15020,Land (fixed),47.73565324,26.64555017,161,,Romania,6 +IASI,0-20000-0-15090,15090,Land (fixed),47.16333333,27.62722222,74.29,,Romania,6 +CEAHLAU TOACA,0-20000-0-15108,15108,Land (fixed),46.97751,25.94993997,1897,,Romania,6 +CLUJ-NAPOCA,0-20000-0-15120,15120,Land (fixed),46.7777705,23.57130529,410,,Romania,6 +BACAU,0-20000-0-15150,15150,Land (fixed),46.55777778,26.89666667,174,,Romania,6 +MIERCUREA CIUC,0-20000-0-15170,15170,Land (fixed),46.37131666,25.77261668,661,,Romania,6 +ARAD,0-20000-0-15200,15200,Land (fixed),46.1335164,21.35362152,116.59,,Romania,6 +DEVA,0-20000-0-15230,15230,Land (fixed),45.86492301,22.89880624,240,,Romania,6 +SIBIU,0-20000-0-15260,15260,Land (fixed),45.79018,24.036245,450,,Romania,6 +VARFU OMU,0-20000-0-15280,15280,Land (fixed),45.4457928,25.45669098,2504,,Romania,6 +CARANSEBES,0-20000-0-15292,15292,Land (fixed),45.41667,22.22917,241,,Romania,6 +GALATI,0-20000-0-15310,15310,Land (fixed),45.47291814,28.03230106,69,,Romania,6 +TULCEA,0-20000-0-15335,15335,Land (fixed),45.19050648,28.82416076,4.36,,Romania,6 +RAMNICU VALCEA,0-20000-0-15346,15346,Land (fixed),45.08882112,24.36281391,237,,Romania,6 +BUZAU,0-20000-0-15350,15350,Land (fixed),45.13266329,26.85173192,97,,Romania,6 +SULINA,0-20000-0-15360,15360,Land (fixed),45.1623111,29.7268286,12.69,,Romania,6 +DROBETA-TURNU SEVERIN,0-20000-0-15410,15410,Land (fixed),44.6264587,22.62607371,77,,Romania,6 +BUCURESTI BANEASA,0-20000-0-15420,15420,Land (fixed),44.510433,26.07819041,90,,Romania,6 +CRAIOVA,0-20000-0-15450,15450,Land (fixed),44.31014043,23.86698474,192,,Romania,6 +CALARASI,0-20000-0-15460,15460,Land (fixed),44.20573853,27.33830807,18.72,,Romania,6 +ROSIORII DE VEDE,0-20000-0-15470,15470,Land (fixed),44.10721334,24.97874007,102.15,,Romania,6 +CONSTANTA,0-20000-0-15480,15480,Land (fixed),44.21381439,28.64556468,12.8,,Romania,6 diff --git a/synop2bufr/__init__.py b/synop2bufr/__init__.py index b3be619..7b8cb9d 100644 --- a/synop2bufr/__init__.py +++ b/synop2bufr/__init__.py @@ -348,7 +348,7 @@ def parse_synop(message: str, year: int, month: int) -> dict: # log a warning and set both values to None if A < D: LOGGER.warning(f"Reported dewpoint temperature {D} is greater than the reported air temperature {A}. Elements set to missing") # noqa - warning_msgs.append(f"Reported dewpoint temperature {D} is greater than the reported air temperature {A}. Elements set to missing") # noqa + warning_msgs.append(f"Reported dewpoint temperature {D} is greater than the reported air temperature {A}. Elements set to missing") # noqa output['air_temperature'] = None output['dewpoint_temperature'] = None @@ -1340,6 +1340,18 @@ def transform(data: str, metadata: str, year: int, # check we have data if message is None: continue + + # Check data is just a NIL report, if so warn the user and do + # not create an empty BUFR file + nil_pattern = r"^[A-Za-z]{4} \d{5} (\d{5}) [Nn][Il][Ll]$" + match = re.match(nil_pattern, message) + if match: + LOGGER.warning( + f"NIL report detected for station {match.group(1)}, no BUFR file created.") # noqa + warning_msgs.append( + f"NIL report detected for station {match.group(1)}, no BUFR file created.") # noqa + continue + # create dictionary to store / return result in result = dict() @@ -1444,7 +1456,8 @@ def transform(data: str, metadata: str, year: int, {"eccodes_key": f"#{idx+2}#heightOfBaseOfCloud", "value": f"data:cloud_height_s3_{idx+1}"} ] - mapping.update(s3_mappings[i] for i in range(4)) + for m in s3_mappings: + mapping.update(m) for idx in range(num_s4_clouds): # Based upon the station height metadata, the @@ -1480,8 +1493,10 @@ def transform(data: str, metadata: str, year: int, {"eccodes_key": f"#{idx+1}#cloudTopDescription", "value": f"data:cloud_top_s4_{idx+1}"} ] - mapping.update(s4_mappings[i] for i in range(4)) - except Exception: + for m in s4_mappings: + mapping.update(m) + except Exception as e: + LOGGER.error(e) LOGGER.error(f"Missing station height for station {tsi}") error_msgs.append( f"Missing station height for station {tsi}")