pyradtran.clouds.CloudFileWriter#
- class pyradtran.clouds.CloudFileWriter[source]#
Bases:
objectPersist
CloudLayersequences as libRadtran.datfiles.Two static methods are provided — one per cloud phase:
write_water_cloud_file()→wc_file 1Dwrite_ice_cloud_file()→ic_file 1D
The output format is a three-column ASCII table (altitude, water-content, effective-radius) understood by libRadtran’s
wc_file/ic_fileinput options.See also
CloudGeneratorBuild
CloudLayerlists from data or parameters.
- static write_ice_cloud_file(cloud_layers: List[CloudLayer], output_path: Path, include_zero_layers: bool = True, altitude_resolution_km: float = 0.1) Path[source]#
Write an ice-cloud
.datfile for libRadtran.Analogous to
write_water_cloud_file()but usesiwc_g_m3and defaults to a 30 µm effective radius.- Parameters:
cloud_layers (list of CloudLayer) – Layers to rasterise. Only entries with
iwc_g_m3 > 0contribute unless include_zero_layers is set.output_path (pathlib.Path) – Destination file.
include_zero_layers (bool, default
True) – Write zero-IWC grid points when True.altitude_resolution_km (float, default
0.1) – Vertical spacing of the output grid (km).
- Returns:
output_path.
- Return type:
pathlib.Path
Examples
>>> CloudFileWriter.write_ice_cloud_file(layers, Path("ic.dat")) PosixPath('ic.dat')
- static write_water_cloud_file(cloud_layers: List[CloudLayer], output_path: Path, include_zero_layers: bool = True, altitude_resolution_km: float = 0.1) Path[source]#
Write a water-cloud
.datfile for libRadtran.The file contains three columns — altitude (km), liquid water content (g m⁻³), and effective radius (µm) — on a regular altitude grid.
- Parameters:
cloud_layers (list of CloudLayer) – Layers to rasterise. Only entries with
lwc_g_m3 > 0contribute unless include_zero_layers is set.output_path (pathlib.Path) – Destination file. Parent directories are created automatically.
include_zero_layers (bool, default
True) – If True, grid points outside any layer are written as zero LWC. Set to False to skip them.altitude_resolution_km (float, default
0.1) – Vertical spacing of the output grid (km).
- Returns:
output_path (echoed back for convenience).
- Return type:
pathlib.Path
Examples
>>> from pathlib import Path >>> layers = CloudGenerator.from_simple_parameters( ... z_base_km=1.0, z_top_km=2.0, lwc_g_m3=0.3 ... ) >>> CloudFileWriter.write_water_cloud_file(layers, Path("wc.dat")) PosixPath('wc.dat')