@@ -105,14 +105,14 @@ ptime GDALTimesnap::snapToInterval(TimeUnit snapUnit, int intervalValue, ptime s
105105
106106
107107
108- // calculates the filename for queried time by snapping the wanted time to the
108+ // calculates the filename for queried time by snapping the wanted time to the
109109// nearest smaller timestamp that exists for the dataset
110110// TODO: move general parameter parsing to a more appropriate function
111111GDALTimesnap::GDALDataLoadingInfo GDALTimesnap::getDataLoadingInfo (Json::Value datasetJson, int channel, const TemporalReference &tref)
112112{
113113 // get parameters
114114 Json::Value channelJson = datasetJson[" channels" ][channel];
115-
115+
116116 // get parameters
117117 std::string time_format = channelJson.get (" time_format" , datasetJson.get (" time_format" , " " )).asString ();
118118 std::string time_start = channelJson.get (" time_start" , datasetJson.get (" time_start" , " " )).asString ();
@@ -129,7 +129,7 @@ GDALTimesnap::GDALDataLoadingInfo GDALTimesnap::getDataLoadingInfo(Json::Value d
129129 " , fileName: " , fileName
130130 )
131131 );
132-
132+
133133 channel = channelJson.get (" channel" , channel).asInt ();
134134
135135 // resolve time
@@ -154,8 +154,12 @@ GDALTimesnap::GDALDataLoadingInfo GDALTimesnap::getDataLoadingInfo(Json::Value d
154154
155155 // check if requested time is in range of dataset timestamps
156156 // a dataset only has start not end time. if wantedtime is past the last file of dataset, it can simply not be loaded.
157- if (wantedTimeUnix < time_start_mapping || wantedTimeUnix > time_end_mapping)
158- throw NoRasterForGivenTimeException (" Requested time is not in range of dataset" );
157+ if (wantedTimeUnix < time_start_mapping || wantedTimeUnix > time_end_mapping) {
158+ throw NoRasterForGivenTimeException (
159+ " Requested time is not in range of dataset" ,
160+ MappingExceptionType::PERMANENT
161+ );
162+ }
159163
160164 if (datasetJson.isMember (" time_interval" ) || channelJson.isMember (" time_interval" )) {
161165 Json::Value timeInterval = channelJson.get (" time_interval" , datasetJson.get (" time_interval" , Json::Value (Json::objectValue)));
@@ -231,11 +235,14 @@ GDALTimesnap::GDALDataLoadingInfo GDALTimesnap::getDataLoadingInfo(Json::Value d
231235 break ;
232236 }
233237 }
234-
238+
235239 if (time_channel <= 0 ) {
236- throw NoRasterForGivenTimeException (" No channel corresponds to the requested time" );
240+ throw NoRasterForGivenTimeException (
241+ " No channel corresponds to the requested time" ,
242+ MappingExceptionType::PERMANENT
243+ );
237244 }
238-
245+
239246 Log::debug (concat (" getDataLoadingInfo: setting channel to: " , time_channel, " (was: " , channel," ) for time: " , wantedTimeUnix));
240247 channel = time_channel;
241248 }
@@ -259,7 +266,7 @@ GDALTimesnap::GDALDataLoadingInfo GDALTimesnap::getDataLoadingInfo(Json::Value d
259266 boost::filesystem::path file_path (path);
260267 file_path /= fileName;
261268 std::string dataset_file_path = file_path.string ();
262- Log::debug (concat (" getDataLoadingInfo: file_path: " , file_path));
269+ Log::debug (concat (" getDataLoadingInfo: file_path: " , file_path));
263270
264271 // Handle NetCDF subdatasets
265272 if (channelJson.isMember (" netcdf_subdataset" ) || datasetJson.isMember (" netcdf_subdataset" )) {
0 commit comments