pyiem.nws.ugc module
Something to store UGC information!
-
pyiem.nws.ugc.ugcs_to_text(ugcs)[source]
Convert a list of UGC objects to a textual string
-
pyiem.nws.ugc.str2time(text, valid)[source]
Convert a string that is the UGC product expiration to a valid
datetime
@param text string to convert
@param valid datetime instance
-
class pyiem.nws.ugc.UGC(state, geoclass, number, name=None, wfos=None)[source]
Bases: object
Representation of a single UGC
-
__str__()[source]
Override str()
-
__repr__()[source]
Override repr()
-
__eq__(other)[source]
Compare this UGC with another
-
__ne__(other)[source]
Compare this UGC with another
-
class pyiem.nws.ugc.UGCProvider(*args, **kwargs)[source]
Bases: object
Wrapper around dataframe to provide UGC information.
-
static __new__(cls, *args, **kwargs)[source]
Singleton, if the price is right.
-
__contains__(key)[source]
Check if this provider knows about this UGC.
- Parameters:
key (str or UGC) – the UGC to lookup
- Returns:
bool
- Return type:
bool
-
get(key, is_firewx=False)[source]
Return what this provider knows about a given UGC.
The complication is that we always want something, either a newly
created UGC instance or a new one materialized by the internal
dataframe stored metadata.
- Parameters:
key (str or UGC) – the UGC to lookup
is_firewx (bool) – is this a fire weather product, so firewx zones
- Returns:
UGC instance
- Return type:
UGC
-
__getitem__(key)[source]
Dictionary access helper.
-
pyiem.nws.ugc.parse(text, valid, ugc_provider=None, is_firewx=False)[source]
Return UGC list and expiration time.
- Parameters:
text (str) – text to parse.
valid (datetime) – the text product’s valid time.
ugc_provider (UGCProvider) – what will generate UGC instances for us.
is_firewx (bool) – is this product a fire weather product.
- Return type:
tuple[list[UGC], datetime | None]