in sdap/processors/tilereadingprocessor.py [0:0]
def parse_input(the_input_tile, temp_dir):
specs = [the_input_tile.summary.section_spec]
# Generate a list of tuples, where each tuple is a (string, map) that represents a
# tile spec in the form (str(section_spec), { dimension_name : slice, dimension2_name : slice })
tile_specifications = [slices_from_spec(section_spec) for section_spec in specs]
file_path = the_input_tile.summary.granule
file_name = file_path.split(sep)[-1]
# If given a temporary directory location, copy the file to the temporary directory and return that path
if temp_dir is not None:
temp_file_path = path.join(temp_dir, file_name)
with closing(urlopen(file_path)) as original_granule:
with open(temp_file_path, 'wb') as temp_granule:
for chunk in iter((lambda: original_granule.read(512000)), ''):
temp_granule.write(chunk)
file_path = temp_file_path
# Remove file:// if it's there because netcdf lib doesn't like it
file_path = file_path[len('file:'):] if file_path.startswith('file:') else file_path
return tile_specifications, file_path