Skip to main content

This a python package to run and download submitted files on RSHub

Reason this release was yanked:

version contains critical errors

Project description

Toolbox overview

  • submit_jobs.run: submit a simulation job to the RSHub service.
  • submit_jobs.check_completion: poll a job’s task status/path.
  • loader = load_file.load_file: helper class to list, download, and load outputs.
  • loader.list_files: list available outputs filtered by expected extension.
  • loader.load_outputs: load or download outputs (auto memory/disk or forced).

RSHub client quickstart

This package lets you submit simulation jobs and fetch the resulting files from the RSHub service.

Prerequisites

  • Python 3.8+ with requests, pandas, scipy, h5py, and tqdm available.

Function 1: Submit a job and job status

from rshub.submit_jobs import run, check_completion

payload = {
    "token": "YOUR_TOKEN",
    "project_name": "demo_project",
    "task_name": "snow_run_001",
    # ...other inputs expected by the backend...
}

# Fire off the job
resp = run(payload)
print("Submission response:", resp)

# Later, poll status
status = check_completion(payload["token"], payload["project_name"], payload["task_name"])
print("Task status:", status["task_status"])
  • run posts your JSON payload to the service and returns the parsed JSON on success.

Function 2: Load outputs

load_file.load_file handles listing outputs, downloading files, and loading datasets.

Basic example: load one output file

from rshub.load_file import load_file

loader = load_file(
    token="YOUR_TOKEN",
    project_name="demo_project",
    task_name="snow_run_001",
    scenario_flag="snow",
    algorithm="qms",
    output_var="tb",
)

# Load and return the dataset (auto memory/disk)
data = loader.load_outputs(fGHz=16.7, inc_ang=40)
print(data.keys())  # inspect variables in the file

Full input lists

from rshub.load_file import load_file

loader = load_file(
    token="YOUR_TOKEN",
    project_name="demo_project",
    task_name="snow_run_001",
    scenario_flag="snow",      # matches output_info.csv
    algorithm="qms",
    output_var="tb",
    size_threshold_mb=50,      # switch to disk download above this size
    chunk_size=8192,           # streaming chunk size when downloading
    show_progress=True,        # show tqdm progress for large downloads
)

Constructor inputs (load_file)

  • token, project_name, task_name: identify the job; required for auth/path lookup.
  • scenario_flag, algorithm, output_var: select the output filename.
  • (optional) size_threshold_mb: MB cutoff to switch from in-memory load to disk download. Default: 50.
  • (optional) chunk_size: bytes per stream chunk when downloading large files. Default: 8192.
  • (optional) show_progress: whether to display a tqdm progress bar during large downloads. Default: True

List available output files

print(loader.list_files())

Load an output file

Path1: load using frequency and incident angle

# Autodetect memory vs disk based on size; 
data = loader.load_outputs(fGHz=16.7, inc_ang=40)
  • fGHz: frequency placeholder for filename patterns.
  • inc_ang: incidence angle placeholder for filename patterns.

Path2: load using filename output from load_outputs

filelists = loader.list_files() 
filename=filelists[0]
data = loader.load_outputs(filename)
  • filename: output filename with extension

Other optinal inputs

# Force a strategy
data_mem = loader.load_outputs(fGHz=16.7, inc_ang=40, force_method="memory")
data_disk = loader.load_outputs(fGHz=16.7, inc_ang=40, force_method="disk")
  • (experimental) var: single variable or space-separated names to extract from the loaded data.
  • force_method: "memory" or "disk" to override size-based strategy.
  • download_path: directory path; if set, performs download-only behavior for matching files.

Download-only outputs (wildcard patterns)

loader.load_outputs(download_path="downloads/", fGHz=16.7, inc_ang=40)
  • download_path: local path to download all outputs.

Check error messages for a job

loader.load_error_message()  # prints contents of Job/error.txt if present

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rshub-0.3.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rshub-0.3.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file rshub-0.3.0.tar.gz.

File metadata

  • Download URL: rshub-0.3.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for rshub-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b0f1b56f103b869bf5efa2b4263cc1a4f1f834e12d37d4747f791be85bf86ab5
MD5 2373d1051c749dc147a969316288dfd7
BLAKE2b-256 023510c00f41ed9ccd677f8c30d22a726e4df4b135325acbaa8cbbb93a305442

See more details on using hashes here.

File details

Details for the file rshub-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: rshub-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for rshub-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7b07204782bd087e9a1d84e53dfd45326fdfedfa1f1a775b4a0aae27ac3f27b
MD5 388eadeb3d0f935c850d286995ce447a
BLAKE2b-256 477239266c7c9c7e444fa49fe4b3734474411a5804bf602c368d594afb032798

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page