|
26 | 26 | # https://files.igs.org/pub/resource/guidelines/Guidelines_for_Long_Product_Filenames_in_the_IGS_v2.1.pdf |
27 | 27 | _RE_IGS_LONG_FILENAME = re.compile( |
28 | 28 | r"""\A # Assert beginning of string |
29 | | - (?P<analysis_center>\w{3}) |
30 | | - (?P<version>\w) |
| 29 | + (?P<analysis_center>\w{3}) # E.g. 'IGS' |
| 30 | + (?P<version>\w) # Version / 'solution identifier'. Typically '0' |
31 | 31 | (?P<project>\w{3}) # Campaign / project |
32 | 32 | (?P<solution_type>\w{3}) # Solution type identifier |
33 | 33 | _ |
@@ -798,6 +798,25 @@ def determine_sp3_name_props( |
798 | 798 | return name_props |
799 | 799 |
|
800 | 800 |
|
| 801 | +def simple_props_from_long_filename(filename: str) -> dict[str, Any]: |
| 802 | + # Simpler version of determine_properties_from_filename(), which does less parsing / conversion / assumption |
| 803 | + # making. Just extracts key fields from IGS long filename and presents them verbatim. |
| 804 | + |
| 805 | + match_long = _RE_IGS_LONG_FILENAME.fullmatch(filename) |
| 806 | + if match_long is None: |
| 807 | + raise ValueError(f"Filename failed to parse as IGS long format: '{filename}'") |
| 808 | + return { |
| 809 | + "analysis_center": match_long["analysis_center"].upper(), |
| 810 | + "content_type": match_long["content_type"].upper(), |
| 811 | + "format_type": match_long["file_format"].upper(), |
| 812 | + "solution_type": match_long["solution_type"], |
| 813 | + "sampling_rate": match_long["sampling"], |
| 814 | + "version": match_long["version"], |
| 815 | + "project": match_long["project"], # Aka 'campaign' |
| 816 | + # Extra fields will be added depending on standard vs Long Term Product |
| 817 | + } |
| 818 | + |
| 819 | + |
801 | 820 | def determine_properties_from_filename( |
802 | 821 | filename: str, |
803 | 822 | expect_long_filenames: bool = False, |
|
0 commit comments