470 measurement_number = measurement_number + 1 |
470 measurement_number = measurement_number + 1 |
471 measurement_id = "%s%02i" % (base_id, measurement_number) |
471 measurement_id = "%s%02i" % (base_id, measurement_number) |
472 |
472 |
473 return measurement_id |
473 return measurement_id |
474 |
474 |
475 def get_ancillary(self, filename, file_type): |
475 def get_ancillary(self, file_path, file_type): |
476 """ |
476 """ |
477 Try to get the ancillary file data from the SCC API. |
477 Try to get the ancillary file data from the SCC API. |
478 |
478 |
479 The result will always be an API object. If the file does not exist, the .exists property is set to False. |
479 The result will always be an API object. If the file does not exist, the .exists property is set to False. |
480 |
480 |
481 Parameters |
481 Parameters |
482 ---------- |
482 ---------- |
483 filename : str |
483 file_path : str |
484 Filename of the uploaded file. |
484 Path of the uploaded file. |
485 file_type : str |
485 file_type : str |
486 Type of ancillary file. One of 'sounding', 'overlap', 'lidarratio'. |
486 Type of ancillary file. One of 'sounding', 'overlap', 'lidarratio'. |
487 |
487 |
488 Returns |
488 Returns |
489 : AncillaryFile |
489 : AncillaryFile |
490 The api object. |
490 The api object. |
491 """ |
491 """ |
492 assert file_type in ['sounding', 'overlap', 'lidarratio'] |
492 assert file_type in ['sounding', 'overlap', 'lidarratio'] |
|
493 |
|
494 filename = os.path.basename(file_path) |
493 |
495 |
494 if file_type == 'sounding': |
496 if file_type == 'sounding': |
495 file_url = self.api_sounding_search_pattern.format(filename) |
497 file_url = self.api_sounding_search_pattern.format(filename) |
496 elif file_type == 'overlap': |
498 elif file_type == 'overlap': |
497 file_url = self.api_overlap_search_pattern.format(filename) |
499 file_url = self.api_overlap_search_pattern.format(filename) |