pyradtran.clouds.generate_cloud_file_from_era5

pyradtran.clouds.generate_cloud_file_from_era5#

pyradtran.clouds.generate_cloud_file_from_era5(era5_dataset: Dataset, output_path: Path, cloud_type: str = 'wc', time: datetime | None = None, lat: float | None = None, lon: float | None = None, **kwargs) Path[source]#

One-step cloud-file generation from an ERA5 dataset.

Combines CloudGenerator.from_era5_dataset() and the appropriate CloudFileWriter method into a single call.

Parameters:
  • era5_dataset (xarray.Dataset) – ERA5 dataset with cloud variables on pressure levels.

  • output_path (pathlib.Path) – Destination .dat file.

  • cloud_type ({“wc”, “ic”}, default "wc") – "wc" for liquid water cloud, "ic" for ice cloud.

  • time (datetime, optional) – Time step to select from the dataset.

  • lat (float, optional) – Coordinates for nearest-neighbour selection.

  • lon (float, optional) – Coordinates for nearest-neighbour selection.

  • **kwargs – Forwarded to CloudGenerator.from_era5_dataset().

Returns:

output_path.

Return type:

pathlib.Path

Raises:

ValueError – If cloud_type is not "wc" or "ic".

Examples

>>> path = generate_cloud_file_from_era5(
...     ds, Path("work/wc.dat"), cloud_type="wc", lat=78.0, lon=15.0
... )

See also

CloudGenerator.from_era5_dataset

Extract layers only (no I/O).

CloudFileWriter

Write layers to disk separately.