pyiem.nws.products.spcpts module#

Storm Prediction Center PTS Product Parser.

My life was not supposed to end like this, what a brutal format.

pyiem.nws.products.spcpts.imgsrc_from_row(row)[source]#

Compute the SPC image source for a given database row.

Parameters:

row (dict)

Return type:

str | None

pyiem.nws.products.spcpts.compute_times(afos, issue, expire, day)[source]#

Compute actual issue, expire time.

For the multi-day products, the text product contains a range of dates that need translated to an actual issue and expire time.

Returns:

  • issue (datetime)

  • expire (datetime)

pyiem.nws.products.spcpts.get_day(prod, text)[source]#

Figure out which day this is for.

pyiem.nws.products.spcpts.get_segments_from_text(text)[source]#

Return list of segments for this text.

pyiem.nws.products.spcpts.str2multipolygon(s)[source]#

Convert string PTS data into a polygon.

Parameters:

s (str) – the cryptic string that we attempt to make valid polygons from

pyiem.nws.products.spcpts.init_days(prod)[source]#

Figure out which days this product should have based on the AFOS.

Return type:

dict[int, SPCOutlookCollection]

class pyiem.nws.products.spcpts.SPCOutlookCollection(issue, expire, day)[source]#

Bases: object

A collection of outlooks for a single ‘day’.

add_outlook(outlook)[source]#

We insert an outlook in an ordered manner.

get_categories()[source]#

Return list of categories covered in this outlook.

difference_geometries()[source]#

Do the difference work to figure out actual geometries.

class pyiem.nws.products.spcpts.SPCOutlook(category, threshold, multipoly)[source]#

Bases: object

A class holding what we store for a single outlook.

class pyiem.nws.products.spcpts.SPCPTS(text, utcnow=None, ugc_provider=None, nwsli_provider=None)[source]#

Bases: TextProduct

A class representing the polygons and metadata in SPC PTS Product.

get_outlookcollection(day)[source]#

Return the SPCOutlookCollection for a given day.

Parameters:

day (int)

Return type:

SPCOutlookCollection | None

get_outlook(category, threshold, day)[source]#

Get an outlook by category and threshold.

draw_outlooks()[source]#

For debugging, draw the outlooks on a simple map for inspection.

set_metadata()[source]#

Set some metadata about this product.

find_issue_expire()[source]#

Determine the period this product is valid for.

find_outlooks()[source]#

Find the outlook sections within the text product.

compute_wfos(_txn=None)[source]#

Figure out which WFOs are impacted by this polygon.

sql(txn)[source]#

Do database work.

Parameters:

txn (psycopg.cursor) – database cursor

get_descript_and_url()[source]#

Help to convert awips id into strings.

get_jabbers(uri, _uri2=None)[source]#

Wordsmith the Jabber/Twitter Messaging.

pyiem.nws.products.spcpts.parser(text, utcnow=None, ugc_provider=None, nwsli_provider=None)[source]#

Parse this text.