Dataset Utils

DigitalTyphoonUtils

class pyphoon2.DigitalTyphoonUtils.SPLIT_UNIT(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum denoting which unit to treat as atomic when splitting the dataset

SEQUENCE = 'sequence'
SEASON = 'season'
IMAGE = 'image'
classmethod has_value(value)

Returns true if value is present in the enum

Parameters

value – str, the value to check for

Returns

bool

class pyphoon2.DigitalTyphoonUtils.LOAD_DATA(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum denoting what level of data should be stored in memory

NO_DATA = False
ONLY_TRACK = 'track'
ONLY_IMG = 'images'
ALL_DATA = 'all_data'
classmethod has_value(value)
class pyphoon2.DigitalTyphoonUtils.TRACK_COLS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum containing indices in a track csv col to find the respective data

YEAR = 0
MONTH = 1
DAY = 2
HOUR = 3
GRADE = 4
LAT = 5
LNG = 6
PRESSURE = 7
WIND = 8
DIR50 = 9
LONG50 = 10
SHORT50 = 11
DIR30 = 12
LONG30 = 13
SHORT30 = 14
LANDFALL = 15
INTERPOLATED = 16
FILENAME = 17
MASK_1 = 18
MASK_1_PERCENT = 19
classmethod str_to_value(name)
classmethod has_value(value)
pyphoon2.DigitalTyphoonUtils.parse_image_filename(filename: str, separator='-') -> (<class 'str'>, <class 'datetime.datetime'>, <class 'str'>)

Takes the filename of a Digital Typhoon image and parses it to return the date it was taken, the sequence ID it belongs to, and the satellite that took the image

Parameters
  • filename – str, filename of the image

  • separator – char, separator used in the filename

Returns

(str, datetime, str), Tuple containing the sequence ID, the datetime, and satellite string

pyphoon2.DigitalTyphoonUtils.get_seq_str_from_track_filename(filename: str) str

Given a track filename, returns the sequence ID it belongs to

Parameters

filename – str, the filename

Returns

str, the sequence ID string

pyphoon2.DigitalTyphoonUtils.is_image_file(filename: str) bool

Given a DigitalTyphoon file, returns if it is an h5 image.

Parameters

filename – str, the filename

Returns

bool, True if it is an h5 image, False otherwise