swirlspy.obs package
Weather observations decoder.
- class swirlspy.obs.Lightning(filenames, proj, start_time, end_time, minutize=True, tz='utc')
 Bases:
objectA class for storing lightning data. This class is initialised from LLIS text file(s).
- Parameters
 filenames (str of list of str) – Name or path of file(s) to read.
proj (str) – Name of projection system.
start_time (pandas.Timestamp) – Start time of lightning observation period.
end_time (pandas.Timestamp) – End time of lightning observation period.
tz (str) – Time zone of the file. Defaults to ‘utc’.
minutize (bool) – If True, timestamps are rounded down to the nearest minute. Defaults to True.
- start_time
 Start time of lightning observation period.
- Type
 pandas.Timestamp
- end_time
 End time of lightning observation period.
- Type
 pandas.Timestamp
- time
 Time of lightning strikes.
- Type
 pandas.Series
- ly
 Contains the y coodinates of lightning strikes.
- Type
 numpy.1darray
- lx
 Contains the x coodinates of lightning strikes.
- Type
 numpy.1darray
- cloud_indicator
 Contains the type of lightning strike. 0 for cloud-to-ground lightning, 1 for cloud-to-cloud lightning.
- Type
 numpy.1darray
- data_length
 The length of data.
- Type
 int
- obs_type
 Type of weather observation or parameter.
- Type
 str
- proj
 Projection system of y and x coordinates.
- Type
 str
- copy()
 Returns a copy of lightning object.
- reproject(inProj, outProj, projname)
 Converts location of lighting strikes from one projection to another.
- Parameters
 inProj (pyproj.Proj) – The projection of the source grid.
outProj (pyproj.Proj) – The projection of the target grid.
projname (str) – Name of the projection of the target grid.
- Returns
 ltg_object – Copy of object with location of lightning strikes in the target coordinate system.
- Return type
 
- class swirlspy.obs.Rain(filename, proj, duration=Timedelta('0 days 01:00:00'), NAN=3276.7)
 Bases:
objectA class for storing raingauge data. Rain object can represent just one raingauge, or a network of raingauges, depending on how many raingauges are inputted. Rain objects can be initialised from text files containing rainfall data.
Format of the text files should adhere to the following:
First line: Timestring (%Y%m%d%H%M) indicating the end timeof rainfall accumulation over a period of time.Starting from second line, each line has four columns:First column: Name of station.Second column: Latitude (or y coordinate) of raingauges.Third column: Longitude (or x coordinate) of raingauges.Fourth column: Accumulated rainfall value.- Parameters
 filename (str or list of strings) – Name(s) of text files to read for data to create a Rain object.
proj (str) – Name of projection system.
duration (pandas.Timedelta) – Accumulation period of each file. Equivalent to the time interval between each file. Defaults to 60 minutes.
NAN (list of floats) – Data values to be ignored when reading the text file. Defaults to 3276.7.
- start_time
 Starting time when raingauge(s) start accumulating rainfall.
- Type
 pandas.Timestamp
- end_time
 Ending time when raingauge(s) stop accumulating rainfall.
- Type
 pandas.Timestamp
- gauge_x
 x-coordinate of raingauge(s) in given projection.
- Type
 numpy.1darray
- gauge_y
 y_coordinate of raingauge(s) in given projection.
- Type
 numpy.1darray
- rainfall
 Accumulated rainfall value of each raingauge(s), between start_time and end_time.
- Type
 numpy.1darray
- station
 Station IDs of raingauge(s).
- Type
 numpy.1darray
- rg_number
 Number of raingauge(s).
- Type
 int
- obs_type
 Type of weather observation or parameter.
- Type
 str
- proj
 Projection system of y and x coordinates.
- Type
 str
- data
 An array of tuple(s), where each tuple contains (y_coord, x_coord, rainfall, station).
- Type
 numpy.1darray
- copy()
 Returns a copy of Rain object.
- remove_bad_stations(bad_stations)
 Remove stations that are noisy.
- bad_stations:
 Stations which are to be filtered out.
- Returns
 rg_object – Return a copy of the Rain object with noisy raingauges filtered out.
- Return type
 
- reproject(inProj, outProj, projname)
 Converts location of raingauge from one projection to another.
- Parameters
 inProj (pyproj.Proj) – The projection of the source grid.
outProj (pyproj.Proj) – The projection of the target grid.
projname (str) – Name of the projection of the target grid.
- Returns
 rg_object – Copy of object with location of raingauges in the target coordinate system.
- Return type
 
Submodules
swirlspy.obs.lightning module
- class swirlspy.obs.lightning.Lightning(filenames, proj, start_time, end_time, minutize=True, tz='utc')
 Bases:
objectA class for storing lightning data. This class is initialised from LLIS text file(s).
- Parameters
 filenames (str of list of str) – Name or path of file(s) to read.
proj (str) – Name of projection system.
start_time (pandas.Timestamp) – Start time of lightning observation period.
end_time (pandas.Timestamp) – End time of lightning observation period.
tz (str) – Time zone of the file. Defaults to ‘utc’.
minutize (bool) – If True, timestamps are rounded down to the nearest minute. Defaults to True.
- start_time
 Start time of lightning observation period.
- Type
 pandas.Timestamp
- end_time
 End time of lightning observation period.
- Type
 pandas.Timestamp
- time
 Time of lightning strikes.
- Type
 pandas.Series
- ly
 Contains the y coodinates of lightning strikes.
- Type
 numpy.1darray
- lx
 Contains the x coodinates of lightning strikes.
- Type
 numpy.1darray
- cloud_indicator
 Contains the type of lightning strike. 0 for cloud-to-ground lightning, 1 for cloud-to-cloud lightning.
- Type
 numpy.1darray
- data_length
 The length of data.
- Type
 int
- obs_type
 Type of weather observation or parameter.
- Type
 str
- proj
 Projection system of y and x coordinates.
- Type
 str
- copy()
 Returns a copy of lightning object.
- reproject(inProj, outProj, projname)
 Converts location of lighting strikes from one projection to another.
- Parameters
 inProj (pyproj.Proj) – The projection of the source grid.
outProj (pyproj.Proj) – The projection of the target grid.
projname (str) – Name of the projection of the target grid.
- Returns
 ltg_object – Copy of object with location of lightning strikes in the target coordinate system.
- Return type
 
swirlspy.obs.rain module
- class swirlspy.obs.rain.Rain(filename, proj, duration=Timedelta('0 days 01:00:00'), NAN=3276.7)
 Bases:
objectA class for storing raingauge data. Rain object can represent just one raingauge, or a network of raingauges, depending on how many raingauges are inputted. Rain objects can be initialised from text files containing rainfall data.
Format of the text files should adhere to the following:
First line: Timestring (%Y%m%d%H%M) indicating the end timeof rainfall accumulation over a period of time.Starting from second line, each line has four columns:First column: Name of station.Second column: Latitude (or y coordinate) of raingauges.Third column: Longitude (or x coordinate) of raingauges.Fourth column: Accumulated rainfall value.- Parameters
 filename (str or list of strings) – Name(s) of text files to read for data to create a Rain object.
proj (str) – Name of projection system.
duration (pandas.Timedelta) – Accumulation period of each file. Equivalent to the time interval between each file. Defaults to 60 minutes.
NAN (list of floats) – Data values to be ignored when reading the text file. Defaults to 3276.7.
- start_time
 Starting time when raingauge(s) start accumulating rainfall.
- Type
 pandas.Timestamp
- end_time
 Ending time when raingauge(s) stop accumulating rainfall.
- Type
 pandas.Timestamp
- gauge_x
 x-coordinate of raingauge(s) in given projection.
- Type
 numpy.1darray
- gauge_y
 y_coordinate of raingauge(s) in given projection.
- Type
 numpy.1darray
- rainfall
 Accumulated rainfall value of each raingauge(s), between start_time and end_time.
- Type
 numpy.1darray
- station
 Station IDs of raingauge(s).
- Type
 numpy.1darray
- rg_number
 Number of raingauge(s).
- Type
 int
- obs_type
 Type of weather observation or parameter.
- Type
 str
- proj
 Projection system of y and x coordinates.
- Type
 str
- data
 An array of tuple(s), where each tuple contains (y_coord, x_coord, rainfall, station).
- Type
 numpy.1darray
- copy()
 Returns a copy of Rain object.
- remove_bad_stations(bad_stations)
 Remove stations that are noisy.
- bad_stations:
 Stations which are to be filtered out.
- Returns
 rg_object – Return a copy of the Rain object with noisy raingauges filtered out.
- Return type
 
- reproject(inProj, outProj, projname)
 Converts location of raingauge from one projection to another.
- Parameters
 inProj (pyproj.Proj) – The projection of the source grid.
outProj (pyproj.Proj) – The projection of the target grid.
projname (str) – Name of the projection of the target grid.
- Returns
 rg_object – Copy of object with location of raingauges in the target coordinate system.
- Return type