- classmethod RSK.create(timestamps: Collection[np.datetime64], values: Collection[Collection[float]], channels: Collection[str], units: Collection[str], filename: str = 'sample.rsk', model: str = 'unknown', serialID: int = 0) RSK ¶
RSKinstance from given time series data.
timestamps¶ (Collection[np.datetime64]) – a 1D array/list of timestamps (np.datetime64 format) of size n
values¶ (Collection[Collection[float]]) – a 2D array/list of data of size [n,m]
channels¶ (Collection[str]) – a 1D array/list of channel names of size m
units¶ (Collection[str]) – a 1D array/list of channel units of size m
filename¶ (str, optional) – filename to give a general description of the data. Defaults to “sample.rsk”.
model¶ (str, optional) – instrument model from which data was collected. Defaults to “unknown”.
serialID¶ (int, optional) – serial ID of the instrument from which data was collected. Defaults to 0.
RSK – created
RSKclass instance with given time series data.
Creates an instance of this class containing data and channels specified by the user. For example, the data could originate from a CTD on a profiling float or a glider. The data could even come from CTDs from manufacturers. The purpose of this function is to allow users to easily apply pyRSKtools post-processing and visualization functions to any dataset. It is particularly convenient when one needs to compare data measured with an RBR CTD to other sources (e.g., other CTDs or bottle samples).
>>> timestamps = [np.datetime64(1651550400000, "ms"), ... np.datetime64(1651550402000, "ms"), ... np.datetime64(1651550404000, "ms")] ... values = [[39.9973, 16.2695, 10.1034], ... [39.9873, 16.2648, 10.1266], ... [39.9887, 16.2553, 10.1247]] ... channels = ["conductivity","temperature","pressure"] ... units = ["mS/cm","°C","dbar"] ... rsk = RSK.create(timestamps=timestamps, values=values, channels=channels, units=units)
- RSK.addchannel(data: Collection[float], channel: str = 'unknown', units: str = 'unknown') None ¶
Add a new channel with a defined channel name and unit. If the new channel already exists in the current RSK instance, it will overwrite the old one.
Adds a new channel with a defined channel name and unit. If the new channel already exists in the
RSKstructure, it will overwrite the old one.
The data for the new channel must be stored in a field of newChan called “values” (i.e.,
newChan.values). If the data is arranged as profiles in the current
RSKinstance, then newChan must be a 1xN array of structures where N = len(
>>> # In this example we compute Absolute Salinity and add it to an :class:`RSK` instance ... # using the TEOS-10 GSW function "SA_from_SP". ... data = gsw.SA_from_SP(rsk.data["salinity"], rsk.data["sea_pressure"], -150, 49) ... rsk.addchannel(data, "absolute_salinity", units="g/kg")
- RSK.removecasts(direction: str = 'up') None ¶
Remove the data elements with either an increasing or decreasing pressure.
direction¶ (str, optional) – cast direction of either “up” or “down”. Defaults to “up”.
Removes either downcasts or upcasts in the current
NOTE: When there are only downcasts in the current
RSKinstance, the request to remove downcasts will not take effect. The same for upcasts.
- RSK.appendlog(logentry: str) None ¶
Append the entry and current time to the log field.
logentry¶ (str) – comment that will be added to the log.
Appends the entry and current time to the log field. It is frequently called by other RSK methods for record use so that the users will not lose track of what happened to the file or the data. This method can also be called by the user to record any customized behaviour.
>>> rsk.appendlog(logentry="New channel practical salinity is added.")
- RSK.printchannels() None ¶
Display instrument information, channel names, and units in the current RSK instance.
Model: RBRconcerto³ Serial ID: 60662 Sampling period: 0.125 second index channel unit _____ ____________________________ _______ 0 'conductivity' 'mS/cm' 1 'temperature' '°C' 2 'pressure' 'dbar' 3 'temperature1' '°C' 4 'temperature2' '°C' 5 'sea_pressure' 'dbar' 6 'salinity' 'PSU'
- RSK.getregionsbytypes(types: Union[Type[Region], Collection[Type[Region]]]) List[Region] ¶
Retrieve all the regions from
RSK.regionsthat match the list of Region types passed in as an argument.
NOTE: a Region type is any class that inherits from