1818from NASADEM import NASADEMConnection
1919
2020from .constants import *
21+ from .exceptions import *
2122from .colors import *
2223from .C3_photosynthesis import *
2324from .C4_photosynthesis import *
@@ -118,18 +119,26 @@ def retrieve_BESS_inputs(ST_C: Union[Raster, np.ndarray], # surface temperature
118119
119120
120121 if CI is None and geometry is not None :
122+ if offline_mode :
123+ raise MissingOfflineParameter ("CI not provided in offline mode" )
124+
121125 if MODISCI_connection is None :
122126 MODISCI_connection = MODISCI ()
123127
128+ logger .info ("loading clumping index" )
124129 CI = MODISCI_connection .CI (geometry = geometry , resampling = resampling )
125130
126131 check_distribution (CI , "CI" )
127132 results ["CI" ] = CI
128133
129134 if elevation_m is None and geometry is not None :
135+ if offline_mode :
136+ raise MissingOfflineParameter ("elevation_m not provided in offline mode" )
137+
130138 if NASADEM_connection is None :
131139 NASADEM_connection = NASADEMConnection ()
132140
141+ logger .info ("loading elevation" )
133142 elevation_m = NASADEM_connection .elevation_m (geometry = geometry )
134143
135144 check_distribution (elevation_m , "elevation_m" )
@@ -138,20 +147,23 @@ def retrieve_BESS_inputs(ST_C: Union[Raster, np.ndarray], # surface temperature
138147
139148 # load minimum NDVI if not provided
140149 if NDVI_minimum is None and geometry is not None :
150+ logger .info ("loading minimum NDVI" )
141151 NDVI_minimum = load_NDVI_minimum (geometry = geometry , resampling = resampling )
142152
143153 check_distribution (NDVI_minimum , "NDVI_minimum" )
144154 results ["NDVI_minimum" ] = NDVI_minimum
145155
146156 # load maximum NDVI if not provided
147157 if NDVI_maximum is None and geometry is not None :
158+ logger .info ("loading maximum NDVI" )
148159 NDVI_maximum = load_NDVI_maximum (geometry = geometry , resampling = resampling )
149160
150161 check_distribution (NDVI_maximum , "NDVI_maximum" )
151162 results ["NDVI_maximum" ] = NDVI_maximum
152163
153164 # load C4 fraction if not provided
154165 if C4_fraction is None :
166+ logger .info ("loading C4 fraction" )
155167 C4_fraction = load_C4_fraction (
156168 geometry = geometry ,
157169 resampling = resampling ,
@@ -163,62 +175,71 @@ def retrieve_BESS_inputs(ST_C: Union[Raster, np.ndarray], # surface temperature
163175
164176 # load carbon uptake efficiency if not provided
165177 if carbon_uptake_efficiency is None :
178+ logger .info ("loading carbon uptake efficiency" )
166179 carbon_uptake_efficiency = load_carbon_uptake_efficiency (geometry = geometry , resampling = resampling )
167180
168181 check_distribution (carbon_uptake_efficiency , "carbon_uptake_efficiency" )
169182 results ["carbon_uptake_efficiency" ] = carbon_uptake_efficiency
170183
171184 # load kn if not provided
172185 if kn is None :
186+ logger .info ("loading kn" )
173187 kn = load_kn (geometry = geometry , resampling = resampling )
174188
175189 check_distribution (kn , "kn" )
176190 results ["kn" ] = kn
177191
178192 # load peak VC max for C3 plants if not provided
179193 if peakVCmax_C3_μmolm2s1 is None :
194+ logger .info ("loading peak VCmax for C3 plants" )
180195 peakVCmax_C3_μmolm2s1 = load_peakVCmax_C3 (geometry = geometry , resampling = resampling )
181196
182197 check_distribution (peakVCmax_C3_μmolm2s1 , "peakVCmax_C3_μmolm2s1" )
183198 results ["peakVCmax_C3_μmolm2s1" ] = peakVCmax_C3_μmolm2s1
184199
185200 # load peak VC max for C4 plants if not provided
186201 if peakVCmax_C4_μmolm2s1 is None :
202+ logger .info ("loading peak VCmax for C4 plants" )
187203 peakVCmax_C4_μmolm2s1 = load_peakVCmax_C4 (geometry = geometry , resampling = resampling )
188204
189205 check_distribution (peakVCmax_C4_μmolm2s1 , "peakVCmax_C4_μmolm2s1" )
190206 results ["peakVCmax_C4_μmolm2s1" ] = peakVCmax_C4_μmolm2s1
191207
192208 # load Ball-Berry slope for C3 plants if not provided
193209 if ball_berry_slope_C3 is None :
210+ logger .info ("loading Ball-Berry slope for C3 plants" )
194211 ball_berry_slope_C3 = load_ball_berry_slope_C3 (geometry = geometry , resampling = resampling )
195212
196213 check_distribution (ball_berry_slope_C3 , "ball_berry_slope_C3" )
197214 results ["ball_berry_slope_C3" ] = ball_berry_slope_C3
198215
199216 # load Ball-Berry slope for C4 plants if not provided
200217 if ball_berry_slope_C4 is None :
218+ logger .info ("loading Ball-Berry slope for C4 plants" )
201219 ball_berry_slope_C4 = load_ball_berry_slope_C4 (geometry = geometry , resampling = resampling )
202220
203221 check_distribution (ball_berry_slope_C4 , "ball_berry_slope_C4" )
204222 results ["ball_berry_slope_C4" ] = ball_berry_slope_C4
205223
206224 # load Ball-Berry intercept for C3 plants if not provided
207225 if ball_berry_intercept_C3 is None :
226+ logger .info ("loading Ball-Berry intercept for C3 plants" )
208227 ball_berry_intercept_C3 = load_ball_berry_intercept_C3 (geometry = geometry , resampling = resampling )
209228
210229 check_distribution (ball_berry_intercept_C3 , "ball_berry_intercept_C3" )
211230 results ["ball_berry_intercept_C3" ] = ball_berry_intercept_C3
212231
213232 # load koppen geiger climate classification if not provided
214233 if KG_climate is None :
234+ logger .info ("loading Koppen-Geiger climate classification" )
215235 KG_climate = load_koppen_geiger (geometry = geometry )
216236
217237 check_distribution (np .float32 (KG_climate ), "KG_climate" )
218238 results ["KG_climate" ] = KG_climate
219239
220240 # load canopy height in meters if not provided
221241 if canopy_height_meters is None :
242+ logger .info ("loading canopy height" )
222243 canopy_height_meters = load_canopy_height (
223244 geometry = geometry ,
224245 resampling = resampling ,
0 commit comments