pyiem.nws.products.shef module#
Standard Hydrological Exchange Format (SHEF).
https://www.weather.gov/media/mdl/SHEF_CodeManual_5July2012.pdf
Formats#
.A - single station, multiple parameter .B - multiple station, multiple parameter, header driven .E - single station, single parameter, evenly spaced time series
Implementation Notes#
The IEM uses a nomenclature of 0.0001 float value to represent Trace values, not the 0.001 that SHEF does.
When
DHis blank orDHM, this generates a SHEFElement with a None valid attribute. This is ambiguous behavior to consider further.
Known Limitations#
4.4.4 DIE special end-of-month specifier not implemented
5.1.4 how to handle repeated data not implemented
Handle when R is being specified in the AR BR ER
5.1.6 revision of a missing value not implemented
5.2.1 DR codes, DRE end of month not implemented
Table 9a D codes not implemented
4.4.1 ugly time logic and DN support
Handle UQ variable SSS.SDDD
Handle UR (tens of degrees)
- pyiem.nws.products.shef.datetime24(dt, replacements)[source]#
Handle the junkiness that is a 24 hour.
- pyiem.nws.products.shef.parse_station_valid(text, utcnow)[source]#
Parse the first token found in a SHEF observation.
- pyiem.nws.products.shef.process_modifiers(text, diction, basevalid)[source]#
Apply modifications based on what the token is telling us.
- Parameters:
text (str) – Potential new information.
diction (SHEFElement) – our current elemenet definition
basevalid (datetime) – the base valid in case of relative time.
- Return type:
bool for if this text was handled.
- pyiem.nws.products.shef.process_message_e(prod, message)[source]#
Process a text string in E SHEF format.
- Parameters:
prod (SHEFProduct) – the product we are working on.
message (str) – The string to parse.
- Return type:
List[SHEFElement]
- pyiem.nws.products.shef.process_message_b(prod, message)[source]#
Convert the message into an object.
- Return type:
- pyiem.nws.products.shef.process_message_a(prod, message)[source]#
Convert the message into an object.
- Return type:
- pyiem.nws.products.shef.process_messages(func, prod, messages)[source]#
Safe frontend to do message processing.
- Return type:
- pyiem.nws.products.shef.compute_num_value(element)[source]#
Attempt to make this into a float.
- Return type:
- class pyiem.nws.products.shef.SHEFProduct(text, utcnow=None, ugc_provider=None, nwsli_provider=None)[source]#
Bases:
TextProductA single text product containing SHEF encoded data.