File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import logging
22from pathlib import Path
33
4+ import dask
45import xarray as xr
56from dask .distributed import Client
67
1516 base_path = Path ("data" )
1617 era5_slice_path = base_path / "era5_slice_2010-01-01_2022-12-31.zarr"
1718 climatology_path = base_path / f"climatology_{ start_year } -{ end_year } .zarr"
19+ climatology_std_path = base_path / f"climatology_std_{ start_year } -{ end_year } .zarr"
1820
1921 client = Client (processes = False , local_directory = dask_spill_folder )
2022 logging .info ("Dask dashboard: %s" , client .dashboard_link )
2325 X = X .sel (time = slice (str (start_year ), str (end_year )))
2426
2527 logging .info ("Calculating climatology..." )
26- climatology = compute_climatology (X )
28+ climatology , climatology_std = compute_climatology (X , probabilistic = True )
2729 logging .info ("Done." )
2830
2931 logging .info ("Rechunking..." )
4042
4143 logging .info ("Saving to disk..." )
4244 climatology_path .parent .mkdir (exist_ok = True )
43- climatology .to_zarr (
45+ delayed_mean = climatology .to_zarr (
4446 climatology_path ,
4547 zarr_format = 2 ,
4648 mode = "w" ,
49+ compute = False ,
4750 )
51+ delayed_std = climatology_std .to_zarr (
52+ climatology_std_path ,
53+ zarr_format = 2 ,
54+ mode = "w" ,
55+ compute = False ,
56+ )
57+ dask .compute (delayed_mean , delayed_std )
58+
4859 logging .info ("Done." )
4960
5061 client .close ()
You can’t perform that action at this time.
0 commit comments