tessl install tessl/pypi-h5netcdf@1.6.0netCDF4 file access via h5py with hierarchical and legacy APIs for scientific computing
Agent Success
Agent success rate when using this tile
69%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.83x
Baseline
Agent success rate without this tile
83%
Build a hierarchical climate data management system that organizes weather station data by region and station using netCDF4 format.
Create a Python module that manages climate data in a hierarchical structure. The module should:
The file organizes data hierarchically:
Implement these functions:
@generates
def create_climate_file(filename: str):
"""
Create a new netCDF4 file for storing hierarchical climate data.
Args:
filename: Path to the netCDF4 file to create
Returns:
File object (should support context manager protocol)
"""
pass
def add_region(file_or_filename, region_name: str) -> None:
"""
Add a new regional group to the file.
Args:
file_or_filename: File object or path to netCDF4 file
region_name: Name of the region group to create
"""
pass
def add_station(file_or_filename, region_name: str, station_name: str,
lat: float, lon: float) -> None:
"""
Add a weather station group within a region, with location metadata.
Args:
file_or_filename: File object or path to netCDF4 file
region_name: Name of the parent region group
station_name: Name of the station group to create
lat: Latitude of the station (stored as an attribute)
lon: Longitude of the station (stored as an attribute)
"""
pass
def store_temperatures(file_or_filename, region_name: str, station_name: str,
temp_values: list) -> None:
"""
Store temperature measurements in a station's variable.
Args:
file_or_filename: File object or path to netCDF4 file
region_name: Name of the region group
station_name: Name of the station group
temp_values: List of temperature values to store
"""
pass
def get_all_regions(file_or_filename) -> list:
"""
Get names of all regional groups in the file.
Args:
file_or_filename: File object or path to netCDF4 file
Returns:
List of region names
"""
pass
def get_region_stations(file_or_filename, region_name: str) -> list:
"""
Get names of all station groups within a region.
Args:
file_or_filename: File object or path to netCDF4 file
region_name: Name of the region group
Returns:
List of station names
"""
passProvides netCDF4 file format support with hierarchical group capabilities.