netCDF4 file access via h5py with hierarchical and legacy APIs for scientific computing
69
Build a system to manage time series data with dynamically growing dimensions.
Create a tool that manages environmental sensor data stored in a netCDF4 file. The system must handle time series data where both the time dimension and the station dimension can grow dynamically as new measurements are added.
Your implementation should:
time and stationThe file should contain:
time and stationtemperature with dimensions (time, station) storing float valueshumidity with dimensions (time, station) storing float valuestemperature.attrs['units'] = 'celsius')time and station dimensions with size 0 @testtime size to 1 and station size to 3 @testtime to 2 while station remains 3 @teststation to 4 and pads historical data with fill values @testtime and station counts accurately @test@generates
class SensorDataManager:
"""Manages environmental sensor time series data in netCDF4 format."""
def __init__(self, filename: str):
"""Initialize the manager with a netCDF4 file.
Args:
filename: Path to the netCDF4 file to create or open
"""
pass
def initialize(self) -> None:
"""Create the file structure with unlimited dimensions and variables."""
pass
def add_timepoint(self, temperature_data: list, humidity_data: list) -> None:
"""Add a new time point with measurements for all existing stations.
Args:
temperature_data: Temperature values for each station
humidity_data: Humidity values for each station
"""
pass
def add_station(self, historical_temps: list, historical_humids: list) -> None:
"""Add a new station with historical data for all existing time points.
Args:
historical_temps: Temperature values for each existing time point
historical_humids: Humidity values for each existing time point
"""
pass
def get_dimensions(self) -> tuple:
"""Get current sizes of time and station dimensions.
Returns:
Tuple of (time_size, station_size)
"""
pass
def close(self) -> None:
"""Close the netCDF4 file."""
passProvides netCDF4 file access with support for unlimited dimensions and dynamic resizing.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-h5netcdfdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10