Project

General

Profile

Revision 809:e12ac8c88c25

IDe12ac8c88c25
Parent 808:9dda39dd51cb
Child 810:24bcdf3e6692

Added by Maarten Sneep about 2 years ago

Capture empty input granules before they cause damage

View differences:

src/pycama/Reader.py
1180 1180
        files = self.find_files(**kwargs)
1181 1181
        products = list(files.keys())
1182 1182
        n_files = len(files[products[0]])
1183
        if n_files == 0:
1184
            raise CAMAException("No input files found", 255)
1185
            
1183 1186
        self.logger.progress("Starting to ingest data")
1184 1187
        try:
1185 1188
            offsets = self.joborder.config['offsets']
1186 1189
        except KeyError:
1187 1190
            offsets = None
1191
        have_data = False
1188 1192
        for i in range(n_files):
1189 1193
            if i > 0:
1190 1194
                self.logger.progress("ingesting:{0:5.1f}%".format(100*i/n_files))
......
1193 1197

  
1194 1198
            for p in products:
1195 1199
                check_warning_counter()
1196
                try:
1197
                    self.read_file(files[p][i], p, scanline_selection=selected_scanlines[p])
1198
                except TypeError:
1199
                    raise CAMAException("Time matching left us without observations", 255)
1200 1200
                orbit = files[p][i].orbit
1201 1201
                orbit_numbers.append(orbit)
1202 1202
                key = '{0:05d}_{1:%Y%m%dT%H%M%S}'.format(orbit, files[p][i].validity_start)
......
1215 1215
                    self.input_pointer[p]['orbit_' + key] = ip
1216 1216

  
1217 1217
                self.read_events(files[p][i].ref, p, 'orbit_' + key)
1218
                
1219
                try:
1220
                    self.read_file(files[p][i], p, scanline_selection=selected_scanlines[p])
1221
                except TypeError:
1222
                    raise CAMAException("Time matching left us without observations", 255)
1223
                
1218 1224
                files[p][i].close()
1219 1225

  
1220 1226
            if not all(x == orbit_numbers[0] for x in orbit_numbers):
1221 1227
                message = "Not all files for all products refer to the same orbit [{0}]".format(", ".join([str(v) for v in orbit_numbers]))
1222 1228
                raise CAMAException(message, 255)
1223

  
1229
                
1230
            if self.variables['latitude'].orbit_data is None:
1231
                self.logger.warning("No data found for orbit {0}.".format(orbit_numbers[0]))
1232
                continue
1233
            have_data = True
1234
            
1224 1235
            self.synthetic_variables()
1225 1236
            sza_out_of_range = self.sync()
1226 1237
            self.smash_gather(orbit_numbers[0], sza_out_of_range)
1238
        
1239
        if not have_data:
1240
            raise CAMAException("No data found in input. All retrievals failed for input data", 255)
1241
            
1227 1242
        self.collect_aggregate_data()
1228 1243

  
1229 1244
    ## Which variables are available?

Also available in: Unified diff