pyradtran.interface.PyRadtranAccessor#
- class pyradtran.interface.PyRadtranAccessor(xarray_obj)[source]#
Bases:
objectxarray accessor for running libRadtran simulations.
Registered as
ds.pyradtran. The primary method isrun(), which parallelisesuvspecover every point in the dataset.Examples
>>> result = ds.pyradtran.run( ... config_path="config/my_config.yaml", ... era5_atmosphere=era5_ds, ... parameter_overrides={"albedo": 0.85}, ... )
See also
execute_simulation_batchThe underlying parallel driver.
__init__(xarray_obj)inspect_cloud_file([selector, ...])Preview the cloud-profile file that would be generated.
run([config_path, config, ...])Run
uvspecfor every point in the dataset.run_uvspec([config_path, config, ...])Alias for
run()— kept for backwards compatibility with older notebooks that callds.pyradtran.run_uvspec(...).- inspect_cloud_file(selector: Dict[str, Any] = None, parameter_overrides: Dict[str, Any] = None, cloud_wc_var: str | None = None, cloud_ic_var: str | None = None, cloud_reff_var: str | None = None, cloud_ic_reff_var: str | None = None, cloud_top_var: str | None = None, cloud_bottom_var: str | None = None) str[source]#
Preview the cloud-profile file that would be generated.
- Parameters:
selector (dict, optional) – Passed to
Dataset.sel()to pick a single point. Defaults to the first element along every dimension.parameter_overrides (dict, optional)
cloud_wc_var (str, optional)
cloud_ic_var (str, optional)
cloud_reff_var (str, optional)
cloud_ic_reff_var (str, optional)
cloud_top_var (str, optional)
cloud_bottom_var (str, optional)
- Returns:
Column-formatted cloud profile, or an explanatory message when no cloud can be constructed.
- Return type:
str
- run(config_path: str | Path | None = None, config: SimulationConfig | None = None, parameter_overrides: Dict[str, Any] = None, time_var: str = 'time', lat_var: str = 'latitude', lon_var: str = 'longitude', albedo_var: str | None = None, surface_temperature_var: str | None = None, surface_type_var: str | None = None, era5_atmosphere: Dataset | None = None, return_dataset: bool = True, save_to_file: bool = True, output_path: str | Path | None = None, progress_callback: callable | None = None, cloud_wc_var: str | None = None, cloud_ic_var: str | None = None, cloud_reff_var: str | None = None, cloud_ic_reff_var: str | None = None, cloud_top_var: str | None = None, cloud_bottom_var: str | None = None, show_progress: bool = True) Dataset | Path[source]#
Run
uvspecfor every point in the dataset.- Parameters:
config_path (str or pathlib.Path, optional) – YAML configuration file.
config (SimulationConfig, optional) – Pre-built config (overrides config_path).
parameter_overrides (dict, optional) – Extra
key: valuepairs foruvspec.time_var (str) – Coordinate variable names.
lat_var (str) – Coordinate variable names.
lon_var (str) – Coordinate variable names.
albedo_var (str, optional) – Per-point albedo variable.
surface_temperature_var (str, optional) – Per-point surface-temperature variable.
surface_type_var (str, optional) – Per-point IGBP surface-type variable.
era5_atmosphere (xarray.Dataset, optional) – ERA5 dataset for custom atmosphere profiles.
return_dataset (bool, default
True) – Return results as an xarray Dataset.save_to_file (bool, default
True) – Write results to NetCDF.output_path (str or pathlib.Path, optional) – Destination file (auto-generated when None).
progress_callback (callable, optional) –
callback(current, total).show_progress (bool, default
True) – Show atqdmprogress bar. PassFalseto suppress it (useful when the output will be rendered as HTML).cloud_wc_var (str, optional) – LWC / IWC dataset variables.
cloud_ic_var (str, optional) – LWC / IWC dataset variables.
cloud_reff_var (str, optional) – Effective-radius variables.
cloud_ic_reff_var (str, optional) – Effective-radius variables.
cloud_top_var (str, optional) – Cloud geometry variables (km).
cloud_bottom_var (str, optional) – Cloud geometry variables (km).
- Returns:
Results dataset when return_dataset is True, otherwise the output file path.
- Return type:
xarray.Dataset or pathlib.Path
- Raises:
PyRadtranError – If no valid results are produced.
- run_uvspec(config_path: str | Path | None = None, config: SimulationConfig | None = None, parameter_overrides: Dict[str, Any] = None, time_var: str = 'time', lat_var: str = 'latitude', lon_var: str = 'longitude', albedo_var: str | None = None, surface_temperature_var: str | None = None, surface_type_var: str | None = None, era5_atmosphere: Dataset | None = None, return_dataset: bool = True, save_to_file: bool = True, output_path: str | Path | None = None, progress_callback: callable | None = None, cloud_wc_var: str | None = None, cloud_ic_var: str | None = None, cloud_reff_var: str | None = None, cloud_ic_reff_var: str | None = None, cloud_top_var: str | None = None, cloud_bottom_var: str | None = None, show_progress: bool = True) Dataset | Path#
Alias for
run()— kept for backwards compatibility with older notebooks that callds.pyradtran.run_uvspec(...).