Other methods¶
copy¶
create¶
- 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 ¶
Create an
RSK
instance from given time series data.- Parameters:
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.
- Returns:
RSK – created
RSK
class 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).
Example:
>>> 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)
addchannel¶
- 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.
- Parameters:
Adds a new channel with a defined channel name and unit. If the new channel already exists in the
RSK
structure, 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 currentRSK
instance, then newChan must be a 1xN array of structures where N = len(RSK.data
).Example:
>>> # 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")
removecasts¶
- RSK.removecasts(direction: str = 'up') None ¶
Remove the data elements with either an increasing or decreasing pressure.
- Parameters:
direction¶ (str, optional) – cast direction of either “up” or “down”. Defaults to “up”.
Removes either downcasts or upcasts in the current
RSK
instance.NOTE: When there are only downcasts in the current
RSK
instance, the request to remove downcasts will not take effect. The same for upcasts.Example:
>>> rsk.removecasts(direction="up")
appendlog¶
- RSK.appendlog(logentry: str) None ¶
Append the entry and current time to the log field.
- Parameters:
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.
Example:
>>> rsk.appendlog(logentry="New channel practical salinity is added.")
printchannels¶
- RSK.printchannels() None ¶
Display instrument information, channel names, and units in the current RSK instance.
Example:
>>> rsk.printchannels()
Example output:
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'
getregionsbytypes¶
- RSK.getregionsbytypes(types: Type[Region] | Collection[Type[Region]]) List[Region] ¶
Retrieve all the regions from
RSK.regions
that match the list of Region types passed in as an argument.NOTE: a Region type is any class that inherits from
Region
.- Parameters:
types¶ (Union[Type[Region], Collection[Type[Region]]]) – a single or list of Region type(s)
- Returns:
List[Region] – the filtered list of Region instances obtained from
RSK.regions
.