4
4
from enum import Enum
5
5
from typing import Dict , Optional , Any , List
6
6
from hazard import services
7
- from stactools .osc_hazard import commands
8
7
9
8
import pydantic
9
+ from stactools .osc_hazard .commands import cubify_invocation , collection_invocation , item_invocation
10
10
11
11
logger = logging .getLogger ()
12
12
logger .setLevel (logging .INFO )
@@ -63,7 +63,7 @@ def degree_days_indicator(indicator_generation_params: Annotated[IndicatorGenera
63
63
bucket = indicator_generation_params .bucket ,
64
64
prefix = indicator_generation_params .prefix ,
65
65
store = indicator_generation_params .store ,
66
- write_xarray_compatible_zarr = indicator_generation_params . write_xarray_compatible_zarr ,
66
+ write_xarray_compatible_zarr = False ,
67
67
dask_cluster_kwargs = indicator_generation_params .dask_cluster_kwargs ,
68
68
)
69
69
@@ -83,7 +83,7 @@ def days_tas_above_indicator(indicator_generation_params: Annotated[IndicatorGen
83
83
bucket = indicator_generation_params .bucket ,
84
84
prefix = indicator_generation_params .prefix ,
85
85
store = indicator_generation_params .store ,
86
- write_xarray_compatible_zarr = indicator_generation_params . write_xarray_compatible_zarr ,
86
+ write_xarray_compatible_zarr = False ,
87
87
dask_cluster_kwargs = indicator_generation_params .dask_cluster_kwargs ,
88
88
)
89
89
@@ -95,10 +95,18 @@ def generate_indicators(indicator_generation_params: Annotated[IndicatorGenerati
95
95
if indicator_generation_params .indicator == IndicatorType .days_tas_above :
96
96
logger .info ("Generating Days TAS Above Indicators" )
97
97
days_tas_above_indicator (indicator_generation_params )
98
- output_dir = indicator_generation_params .store
99
- logger .info ("Generated indicators, now generating cubified zarr" )
100
- commands .cubify_invocation (store_path = f"{ output_dir } /chronic_heat/osc/v2" , output_dir = f"{ output_dir } /cubified/" , indicator_name = indicator_generation_params .indicator .value .replace ("_indicator" , "" ))
101
- logger .info ("Generated cubified zarr" )
98
+
99
+ @app .command ()
100
+ def cubify_indicator (store_path : str , output_dir : str , indicator_name : str ):
101
+ cubify_invocation (store_path , output_dir , indicator_name )
102
+
103
+ @app .command ()
104
+ def create_collection (sources : str , destination : str ):
105
+ collection_invocation (sources , destination )
106
+
107
+ @app .command ()
108
+ def create_item (source : str , destination : str ):
109
+ item_invocation (source , destination )
102
110
103
111
if __name__ == "__main__" :
104
112
app ()
0 commit comments