CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-h5netcdf

tessl install tessl/pypi-h5netcdf@1.6.0

netCDF4 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%

task.mdevals/scenario-10/

NetCDF Climate Data Processor

Build a climate data processing utility that creates, reads, and manages netCDF files for storing temperature measurements from multiple weather stations.

Requirements

File Creation

Create netCDF files with:

  • An unlimited "time" dimension for time series data
  • A fixed-size "station" dimension for weather station identifiers
  • A "temperature" variable with shape (time, station) to store measurements
  • Global metadata attributes: "title" and "institution"

File Reading

Read existing netCDF files to:

  • Extract global metadata attributes
  • Query dimension sizes
  • Access dimension and attribute information

File Appending

Append data to existing files:

  • Open files in append mode ('a')
  • Write new measurements to existing variables
  • Flush changes to ensure data persistence

Resource Management

  • Use context managers (with statements) for all file operations
  • Files must be properly closed after operations complete

Test Cases

  • Create a new netCDF file with time and station dimensions, verify the file exists and can be reopened @test
  • Open an existing file in read mode and extract its global title attribute @test
  • Open a file in append mode, add data to an unlimited dimension, and verify the dimension size increased @test
  • Verify that using a file as a context manager properly closes the file after the block exits @test

Implementation

@generates

API

def create_climate_file(filepath, num_stations):
    """
    Create a new netCDF file for climate data storage.

    Args:
        filepath: Path where the netCDF file should be created
        num_stations: Number of weather stations (fixed dimension size)

    Returns:
        None (file is created and closed)
    """
    pass

def read_file_metadata(filepath):
    """
    Read metadata from an existing netCDF file.

    Args:
        filepath: Path to the netCDF file

    Returns:
        dict: Dictionary containing:
            - 'title': Global title attribute
            - 'time_size': Current size of time dimension
            - 'station_size': Size of station dimension
    """
    pass

def append_measurements(filepath, temperature_data):
    """
    Append new temperature measurements to an existing file.

    Args:
        filepath: Path to the netCDF file
        temperature_data: List or array of temperature values to append

    Returns:
        int: New size of the time dimension after append
    """
    pass

Dependencies { .dependencies }

h5netcdf { .dependency }

Provides netCDF4 file format access via h5py.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/h5netcdf@1.6.x
tile.json