import pathlib
import rasterio
import fsarcamp as fc
from fsarcamp import campaign_utils


class CROPEX25Campaign:
    def __init__(self, campaign_folder, try_folder="t01"):
        """
        Data loader for SAR data for the CROPEX 2025 campaign.
        The `campaign_folder` path on the DLR-HR server as of August 2025:
        "/hrdss/HR_Data/Pol-InSAR_InfoRetrieval/01_projects/25CROPEX/"
        """
        self.name = "CROPEX 2025"
        self.campaign_folder = pathlib.Path(campaign_folder)
        self.try_folder = try_folder
        master_track20 = "25cropex0504" if self.try_folder == "t01" else "25cropex1211"
        master_track33 = "25cropex0514" if self.try_folder == "t01" else "25cropex1214"

        # Mapping for the INF folder: pass_name & band -> master_name
        # Here, the default master_name is used in case there are more than one master.
        self._pass_band_to_master = {
            ("25cropex0103", "C"): master_track20,
            ("25cropex0103", "L"): master_track20,
            ("25cropex0103", "X"): None,
            ("25cropex0105", "C"): master_track20,
            ("25cropex0105", "L"): master_track20,
            ("25cropex0105", "X"): None,
            ("25cropex0106", "C"): master_track20,
            ("25cropex0106", "L"): master_track20,
            ("25cropex0106", "X"): None,
            ("25cropex0107", "C"): None,
            ("25cropex0107", "L"): None,
            ("25cropex0107", "X"): None,
            ("25cropex0108", "C"): master_track20,
            ("25cropex0108", "L"): master_track20,
            ("25cropex0109", "C"): master_track20,
            ("25cropex0109", "L"): master_track20,
            ("25cropex0110", "C"): master_track20,
            ("25cropex0110", "L"): master_track20,
            ("25cropex0111", "C"): master_track20,
            ("25cropex0111", "L"): master_track20,
            ("25cropex0112", "C"): master_track20,
            ("25cropex0112", "L"): master_track20,
            ("25cropex0113", "C"): master_track20,
            ("25cropex0113", "L"): master_track20,
            ("25cropex0115", "L"): master_track20,
            ("25cropex0115", "S"): master_track33,
            ("25cropex0117", "L"): master_track20,
            ("25cropex0117", "S"): master_track33,
            ("25cropex0118", "L"): master_track20,
            ("25cropex0118", "S"): master_track33,
            ("25cropex0119", "L"): master_track20,
            ("25cropex0119", "S"): master_track33,
            ("25cropex0120", "L"): master_track20,
            ("25cropex0120", "S"): master_track33,
            ("25cropex0123", "C"): master_track20,
            ("25cropex0123", "L"): master_track20,
            ("25cropex0124", "C"): master_track20,
            ("25cropex0124", "L"): master_track20,
            ("25cropex0125", "C"): master_track20,
            ("25cropex0125", "L"): master_track20,
            ("25cropex0127", "C"): master_track20,
            ("25cropex0127", "L"): master_track20,
            ("25cropex0202", "C"): master_track20,
            ("25cropex0202", "L"): master_track20,
            ("25cropex0202", "X"): master_track20,
            ("25cropex0203", "C"): master_track20,
            ("25cropex0203", "L"): master_track20,
            ("25cropex0203", "X"): master_track20,
            ("25cropex0204", "C"): master_track20,
            ("25cropex0204", "L"): master_track20,
            ("25cropex0204", "X"): master_track20,
            ("25cropex0205", "C"): master_track20,
            ("25cropex0205", "L"): master_track20,
            ("25cropex0205", "X"): master_track20,
            ("25cropex0206", "C"): master_track20,
            ("25cropex0206", "L"): master_track20,
            ("25cropex0206", "X"): master_track20,
            ("25cropex0207", "C"): master_track20,
            ("25cropex0207", "L"): master_track20,
            ("25cropex0207", "X"): master_track20,
            ("25cropex0208", "C"): master_track20,
            ("25cropex0208", "L"): master_track20,
            ("25cropex0208", "X"): master_track20,
            ("25cropex0209", "C"): master_track20,
            ("25cropex0209", "L"): master_track20,
            ("25cropex0209", "X"): master_track20,
            ("25cropex0210", "C"): master_track20,
            ("25cropex0210", "L"): master_track20,
            ("25cropex0210", "X"): master_track20,
            ("25cropex0212", "C"): master_track20,
            ("25cropex0212", "L"): master_track20,
            ("25cropex0212", "X"): master_track20,
            ("25cropex0213", "C"): None,
            ("25cropex0213", "L"): None,
            ("25cropex0213", "X"): None,
            ("25cropex0215", "L"): master_track20,
            ("25cropex0215", "S"): master_track33,
            ("25cropex0215", "X"): None,
            ("25cropex0217", "L"): master_track20,
            ("25cropex0217", "S"): master_track33,
            ("25cropex0218", "L"): master_track20,
            ("25cropex0218", "S"): master_track33,
            ("25cropex0219", "L"): master_track20,
            ("25cropex0219", "S"): master_track33,
            ("25cropex0220", "L"): master_track20,
            ("25cropex0220", "S"): master_track33,
            ("25cropex0222", "C"): master_track20,
            ("25cropex0222", "L"): master_track20,
            ("25cropex0222", "X"): master_track20,
            ("25cropex0223", "C"): master_track20,
            ("25cropex0223", "L"): master_track20,
            ("25cropex0223", "X"): master_track20,
            ("25cropex0302", "C"): master_track20,
            ("25cropex0302", "L"): master_track20,
            ("25cropex0302", "X"): master_track20,
            ("25cropex0303", "C"): master_track20,
            ("25cropex0303", "L"): master_track20,
            ("25cropex0303", "X"): master_track20,
            ("25cropex0304", "C"): master_track20,
            ("25cropex0304", "L"): master_track20,
            ("25cropex0304", "X"): master_track20,
            ("25cropex0305", "C"): master_track20,
            ("25cropex0305", "L"): master_track20,
            ("25cropex0305", "X"): master_track20,
            ("25cropex0306", "C"): master_track20,
            ("25cropex0306", "L"): master_track20,
            ("25cropex0306", "X"): master_track20,
            ("25cropex0307", "C"): master_track20,
            ("25cropex0307", "L"): master_track20,
            ("25cropex0307", "X"): master_track20,
            ("25cropex0308", "C"): master_track20,
            ("25cropex0308", "L"): master_track20,
            ("25cropex0308", "X"): master_track20,
            ("25cropex0309", "C"): master_track20,
            ("25cropex0309", "L"): master_track20,
            ("25cropex0309", "X"): master_track20,
            ("25cropex0310", "C"): master_track20,
            ("25cropex0310", "L"): master_track20,
            ("25cropex0310", "X"): master_track20,
            ("25cropex0312", "C"): master_track20,
            ("25cropex0312", "L"): master_track20,
            ("25cropex0312", "X"): master_track20,
            ("25cropex0313", "C"): None,
            ("25cropex0313", "L"): None,
            ("25cropex0313", "X"): None,
            ("25cropex0315", "L"): master_track20,
            ("25cropex0315", "S"): master_track33,
            ("25cropex0315", "X"): None,
            ("25cropex0317", "L"): master_track20,
            ("25cropex0317", "S"): master_track33,
            ("25cropex0318", "L"): master_track20,
            ("25cropex0318", "S"): master_track33,
            ("25cropex0319", "L"): master_track20,
            ("25cropex0319", "S"): master_track33,
            ("25cropex0320", "L"): master_track20,
            ("25cropex0320", "S"): master_track33,
            ("25cropex0322", "C"): master_track20,
            ("25cropex0322", "L"): master_track20,
            ("25cropex0322", "X"): master_track20,
            ("25cropex0323", "C"): master_track20,
            ("25cropex0323", "L"): master_track20,
            ("25cropex0323", "X"): master_track20,
            ("25cropex0324", "C"): master_track20,
            ("25cropex0324", "L"): master_track20,
            ("25cropex0324", "X"): master_track20,
            ("25cropex0402", "C"): master_track20,
            ("25cropex0402", "L"): master_track20,
            ("25cropex0402", "X"): master_track20,
            ("25cropex0403", "C"): None,
            ("25cropex0403", "L"): None,
            ("25cropex0403", "X"): None,
            ("25cropex0404", "C"): master_track20,
            ("25cropex0404", "L"): master_track20,
            ("25cropex0404", "X"): master_track20,
            ("25cropex0405", "C"): master_track20,
            ("25cropex0405", "L"): master_track20,
            ("25cropex0405", "X"): master_track20,
            ("25cropex0406", "C"): master_track20,
            ("25cropex0406", "L"): master_track20,
            ("25cropex0406", "X"): master_track20,
            ("25cropex0407", "C"): master_track20,
            ("25cropex0407", "L"): master_track20,
            ("25cropex0407", "X"): master_track20,
            ("25cropex0408", "C"): master_track20,
            ("25cropex0408", "L"): master_track20,
            ("25cropex0408", "X"): master_track20,
            ("25cropex0409", "C"): master_track20,
            ("25cropex0409", "L"): master_track20,
            ("25cropex0409", "X"): master_track20,
            ("25cropex0502", "C"): master_track20,
            ("25cropex0502", "L"): master_track20,
            ("25cropex0502", "X"): master_track20,
            ("25cropex0504", "C"): None,
            ("25cropex0504", "L"): None,
            ("25cropex0504", "X"): master_track20,
            ("25cropex0505", "C"): None,
            ("25cropex0505", "L"): None,
            ("25cropex0505", "X"): None,
            ("25cropex0506", "C"): master_track20,
            ("25cropex0506", "L"): master_track20,
            ("25cropex0506", "X"): master_track20,
            ("25cropex0507", "C"): master_track20,
            ("25cropex0507", "L"): master_track20,
            ("25cropex0507", "X"): master_track20,
            ("25cropex0508", "C"): master_track20,
            ("25cropex0508", "L"): master_track20,
            ("25cropex0508", "X"): master_track20,
            ("25cropex0509", "C"): master_track20,
            ("25cropex0509", "L"): master_track20,
            ("25cropex0509", "X"): master_track20,
            ("25cropex0510", "C"): master_track20,
            ("25cropex0510", "L"): master_track20,
            ("25cropex0510", "X"): master_track20,
            ("25cropex0511", "C"): master_track20,
            ("25cropex0511", "L"): master_track20,
            ("25cropex0511", "X"): master_track20,
            ("25cropex0512", "C"): master_track20,
            ("25cropex0512", "L"): master_track20,
            ("25cropex0512", "X"): master_track20,
            ("25cropex0514", "L"): master_track20,
            ("25cropex0514", "S"): master_track33,
            ("25cropex0514", "X"): None,
            ("25cropex0516", "L"): master_track20,
            ("25cropex0516", "S"): master_track33,
            ("25cropex0517", "L"): master_track20,
            ("25cropex0517", "S"): master_track33,
            ("25cropex0518", "L"): master_track20,
            ("25cropex0518", "S"): master_track33,
            ("25cropex0519", "L"): master_track20,
            ("25cropex0519", "S"): master_track33,
            ("25cropex0521", "C"): master_track20,
            ("25cropex0521", "L"): master_track20,
            ("25cropex0521", "X"): master_track20,
            ("25cropex0522", "C"): master_track20,
            ("25cropex0522", "L"): master_track20,
            ("25cropex0522", "X"): master_track20,
            ("25cropex0523", "C"): master_track20,
            ("25cropex0523", "L"): master_track20,
            ("25cropex0523", "X"): master_track20,
            ("25cropex0524", "C"): master_track20,
            ("25cropex0524", "L"): master_track20,
            ("25cropex0524", "X"): master_track20,
            ("25cropex0602", "C"): master_track20,
            ("25cropex0602", "L"): master_track20,
            ("25cropex0602", "X"): master_track20,
            ("25cropex0603", "C"): master_track20,
            ("25cropex0603", "L"): master_track20,
            ("25cropex0603", "X"): master_track20,
            ("25cropex0604", "C"): None,
            ("25cropex0604", "L"): None,
            ("25cropex0604", "X"): None,
            ("25cropex0605", "C"): master_track20,
            ("25cropex0605", "L"): master_track20,
            ("25cropex0605", "X"): master_track20,
            ("25cropex0606", "C"): master_track20,
            ("25cropex0606", "L"): master_track20,
            ("25cropex0606", "X"): master_track20,
            ("25cropex0607", "C"): master_track20,
            ("25cropex0607", "L"): master_track20,
            ("25cropex0607", "X"): master_track20,
            ("25cropex0608", "C"): master_track20,
            ("25cropex0608", "L"): master_track20,
            ("25cropex0608", "X"): master_track20,
            ("25cropex0609", "C"): master_track20,
            ("25cropex0609", "L"): master_track20,
            ("25cropex0609", "X"): master_track20,
            ("25cropex0610", "C"): master_track20,
            ("25cropex0610", "L"): master_track20,
            ("25cropex0610", "X"): master_track20,
            ("25cropex0611", "C"): master_track20,
            ("25cropex0611", "L"): master_track20,
            ("25cropex0611", "X"): master_track20,
            ("25cropex0703", "C"): master_track20,
            ("25cropex0703", "L"): master_track20,
            ("25cropex0703", "X"): master_track20,
            ("25cropex0704", "C"): master_track20,
            ("25cropex0704", "L"): master_track20,
            ("25cropex0704", "X"): master_track20,
            ("25cropex0705", "L"): master_track20,
            ("25cropex0706", "C"): master_track20,
            ("25cropex0706", "L"): master_track20,
            ("25cropex0706", "X"): master_track20,
            ("25cropex0707", "C"): master_track20,
            ("25cropex0707", "L"): master_track20,
            ("25cropex0707", "X"): master_track20,
            ("25cropex0708", "C"): master_track20,
            ("25cropex0708", "L"): master_track20,
            ("25cropex0708", "X"): master_track20,
            ("25cropex0709", "C"): master_track20,
            ("25cropex0709", "L"): master_track20,
            ("25cropex0709", "X"): master_track20,
            ("25cropex0710", "C"): master_track20,
            ("25cropex0710", "L"): master_track20,
            ("25cropex0710", "X"): master_track20,
            ("25cropex0712", "C"): master_track20,
            ("25cropex0712", "L"): master_track20,
            ("25cropex0712", "X"): master_track20,
            ("25cropex0713", "C"): None,
            ("25cropex0713", "L"): None,
            ("25cropex0713", "X"): None,
            ("25cropex0714", "L"): master_track20,
            ("25cropex0714", "S"): master_track33,
            ("25cropex0714", "X"): None,
            ("25cropex0717", "L"): master_track20,
            ("25cropex0717", "S"): master_track33,
            ("25cropex0718", "L"): master_track20,
            ("25cropex0718", "S"): master_track33,
            ("25cropex0719", "L"): master_track20,
            ("25cropex0719", "S"): master_track33,
            ("25cropex0720", "L"): master_track20,
            ("25cropex0720", "S"): master_track33,
            ("25cropex0722", "C"): master_track20,
            ("25cropex0722", "L"): master_track20,
            ("25cropex0722", "X"): master_track20,
            ("25cropex0723", "C"): master_track20,
            ("25cropex0723", "L"): master_track20,
            ("25cropex0723", "X"): master_track20,
            ("25cropex0724", "C"): master_track20,
            ("25cropex0724", "L"): master_track20,
            ("25cropex0724", "X"): master_track20,
            ("25cropex0725", "C"): master_track20,
            ("25cropex0725", "L"): master_track20,
            ("25cropex0725", "X"): master_track20,
            ("25cropex0802", "C"): None,
            ("25cropex0802", "L"): None,
            ("25cropex0802", "X"): None,
            ("25cropex0803", "C"): master_track20,
            ("25cropex0803", "L"): master_track20,
            ("25cropex0803", "X"): master_track20,
            ("25cropex0805", "C"): master_track20,
            ("25cropex0805", "L"): master_track20,
            ("25cropex0805", "X"): master_track20,
            ("25cropex0806", "C"): master_track20,
            ("25cropex0806", "L"): master_track20,
            ("25cropex0806", "X"): master_track20,
            ("25cropex0807", "C"): master_track20,
            ("25cropex0807", "L"): master_track20,
            ("25cropex0807", "X"): master_track20,
            ("25cropex0808", "C"): master_track20,
            ("25cropex0808", "L"): master_track20,
            ("25cropex0808", "X"): master_track20,
            ("25cropex0809", "C"): master_track20,
            ("25cropex0809", "L"): master_track20,
            ("25cropex0809", "X"): master_track20,
            ("25cropex0810", "C"): master_track20,
            ("25cropex0810", "L"): master_track20,
            ("25cropex0810", "X"): master_track20,
            ("25cropex0811", "C"): master_track20,
            ("25cropex0811", "L"): master_track20,
            ("25cropex0811", "X"): master_track20,
            ("25cropex0812", "C"): master_track20,
            ("25cropex0812", "L"): master_track20,
            ("25cropex0812", "X"): master_track20,
            ("25cropex0814", "L"): master_track20,
            ("25cropex0814", "S"): master_track33,
            ("25cropex0814", "X"): None,
            ("25cropex0816", "L"): master_track20,
            ("25cropex0816", "S"): master_track33,
            ("25cropex0817", "L"): master_track20,
            ("25cropex0817", "S"): master_track33,
            ("25cropex0818", "L"): master_track20,
            ("25cropex0818", "S"): master_track33,
            ("25cropex0819", "L"): master_track20,
            ("25cropex0819", "S"): master_track33,
            ("25cropex0821", "C"): master_track20,
            ("25cropex0821", "L"): master_track20,
            ("25cropex0821", "X"): master_track20,
            ("25cropex0822", "C"): master_track20,
            ("25cropex0822", "L"): master_track20,
            ("25cropex0822", "X"): master_track20,
            ("25cropex0823", "C"): master_track20,
            ("25cropex0823", "L"): master_track20,
            ("25cropex0823", "X"): master_track20,
            ("25cropex0824", "C"): master_track20,
            ("25cropex0824", "L"): master_track20,
            ("25cropex0824", "X"): master_track20,
            ("25cropex0902", "C"): master_track20,
            ("25cropex0902", "L"): master_track20,
            ("25cropex0902", "X"): master_track20,
            ("25cropex0903", "C"): master_track20,
            ("25cropex0903", "L"): master_track20,
            ("25cropex0903", "X"): master_track20,
            ("25cropex0905", "C"): master_track20,
            ("25cropex0905", "L"): master_track20,
            ("25cropex0905", "X"): master_track20,
            ("25cropex0906", "C"): None,
            ("25cropex0906", "L"): None,
            ("25cropex0906", "X"): None,
            ("25cropex0907", "C"): master_track20,
            ("25cropex0907", "L"): master_track20,
            ("25cropex0907", "X"): master_track20,
            ("25cropex0908", "C"): master_track20,
            ("25cropex0908", "L"): master_track20,
            ("25cropex0908", "X"): master_track20,
            ("25cropex0909", "C"): master_track20,
            ("25cropex0909", "L"): master_track20,
            ("25cropex0909", "X"): master_track20,
            ("25cropex0910", "C"): master_track20,
            ("25cropex0910", "L"): master_track20,
            ("25cropex0910", "X"): master_track20,
            ("25cropex0911", "C"): master_track20,
            ("25cropex0911", "L"): master_track20,
            ("25cropex0911", "X"): master_track20,
            ("25cropex0912", "C"): master_track20,
            ("25cropex0912", "L"): master_track20,
            ("25cropex0912", "X"): master_track20,
            ("25cropex0914", "L"): master_track20,
            ("25cropex0914", "S"): master_track33,
            ("25cropex0914", "X"): None,
            ("25cropex0916", "L"): master_track20,
            ("25cropex0916", "S"): master_track33,
            ("25cropex0917", "L"): master_track20,
            ("25cropex0917", "S"): master_track33,
            ("25cropex0918", "L"): master_track20,
            ("25cropex0918", "S"): master_track33,
            ("25cropex0919", "L"): master_track20,
            ("25cropex0919", "S"): master_track33,
            ("25cropex0920", "C"): master_track20,
            ("25cropex0920", "L"): master_track20,
            ("25cropex0920", "X"): master_track20,
            ("25cropex0921", "C"): master_track20,
            ("25cropex0921", "L"): master_track20,
            ("25cropex0921", "X"): master_track20,
            ("25cropex0922", "C"): master_track20,
            ("25cropex0922", "L"): master_track20,
            ("25cropex0922", "X"): master_track20,
            ("25cropex0923", "C"): master_track20,
            ("25cropex0923", "L"): master_track20,
            ("25cropex0923", "X"): master_track20,
            ("25cropex1002", "C"): master_track20,
            ("25cropex1002", "L"): master_track20,
            ("25cropex1002", "X"): master_track20,
            ("25cropex1003", "C"): master_track20,
            ("25cropex1003", "L"): master_track20,
            ("25cropex1003", "X"): master_track20,
            ("25cropex1004", "C"): master_track20,
            ("25cropex1004", "L"): master_track20,
            ("25cropex1004", "X"): master_track20,
            ("25cropex1005", "C"): master_track20,
            ("25cropex1005", "L"): master_track20,
            ("25cropex1005", "X"): master_track20,
            ("25cropex1006", "C"): master_track20,
            ("25cropex1006", "L"): master_track20,
            ("25cropex1006", "X"): master_track20,
            ("25cropex1007", "C"): master_track20,
            ("25cropex1007", "L"): master_track20,
            ("25cropex1007", "X"): master_track20,
            ("25cropex1008", "C"): master_track20,
            ("25cropex1008", "L"): master_track20,
            ("25cropex1008", "X"): master_track20,
            ("25cropex1009", "C"): master_track20,
            ("25cropex1009", "L"): master_track20,
            ("25cropex1009", "X"): master_track20,
            ("25cropex1010", "C"): None,
            ("25cropex1010", "L"): None,
            ("25cropex1010", "X"): None,
            ("25cropex1011", "C"): master_track20,
            ("25cropex1011", "L"): master_track20,
            ("25cropex1011", "X"): master_track20,
            ("25cropex1013", "L"): master_track20,
            ("25cropex1013", "S"): master_track33,
            ("25cropex1013", "X"): None,
            ("25cropex1016", "L"): master_track20,
            ("25cropex1016", "S"): master_track33,
            ("25cropex1017", "L"): master_track20,
            ("25cropex1017", "S"): master_track33,
            ("25cropex1018", "L"): master_track20,
            ("25cropex1018", "S"): master_track33,
            ("25cropex1019", "L"): master_track20,
            ("25cropex1019", "S"): master_track33,
            ("25cropex1021", "C"): master_track20,
            ("25cropex1021", "L"): master_track20,
            ("25cropex1021", "X"): master_track20,
            ("25cropex1022", "C"): master_track20,
            ("25cropex1022", "L"): master_track20,
            ("25cropex1022", "X"): master_track20,
            ("25cropex1023", "C"): master_track20,
            ("25cropex1023", "L"): master_track20,
            ("25cropex1023", "X"): master_track20,
            ("25cropex1024", "C"): master_track20,
            ("25cropex1024", "L"): master_track20,
            ("25cropex1024", "X"): master_track20,
            ("25cropex1025", "C"): None,
            ("25cropex1025", "L"): None,
            ("25cropex1025", "X"): None,
            ("25cropex1102", "C"): None,
            ("25cropex1102", "L"): None,
            ("25cropex1102", "X"): None,
            ("25cropex1103", "C"): master_track20,
            ("25cropex1103", "L"): master_track20,
            ("25cropex1103", "X"): master_track20,
            ("25cropex1104", "C"): master_track20,
            ("25cropex1104", "L"): master_track20,
            ("25cropex1104", "X"): master_track20,
            ("25cropex1105", "C"): master_track20,
            ("25cropex1105", "L"): master_track20,
            ("25cropex1105", "X"): master_track20,
            ("25cropex1106", "C"): master_track20,
            ("25cropex1106", "L"): master_track20,
            ("25cropex1106", "X"): master_track20,
            ("25cropex1107", "C"): master_track20,
            ("25cropex1107", "L"): master_track20,
            ("25cropex1107", "X"): master_track20,
            ("25cropex1108", "C"): master_track20,
            ("25cropex1108", "L"): master_track20,
            ("25cropex1108", "X"): master_track20,
            ("25cropex1109", "C"): master_track20,
            ("25cropex1109", "L"): master_track20,
            ("25cropex1109", "X"): master_track20,
            ("25cropex1110", "C"): master_track20,
            ("25cropex1110", "L"): master_track20,
            ("25cropex1110", "X"): master_track20,
            ("25cropex1111", "C"): master_track20,
            ("25cropex1111", "L"): master_track20,
            ("25cropex1111", "X"): master_track20,
            ("25cropex1202", "C"): master_track20,
            ("25cropex1202", "L"): master_track20,
            ("25cropex1202", "X"): master_track20,
            ("25cropex1203", "C"): master_track20,
            ("25cropex1203", "L"): master_track20,
            ("25cropex1203", "X"): master_track20,
            ("25cropex1204", "C"): master_track20,
            ("25cropex1204", "L"): master_track20,
            ("25cropex1204", "X"): master_track20,
            ("25cropex1205", "C"): master_track20,
            ("25cropex1205", "L"): master_track20,
            ("25cropex1205", "X"): master_track20,
            ("25cropex1206", "C"): master_track20,
            ("25cropex1206", "L"): master_track20,
            ("25cropex1206", "X"): master_track20,
            ("25cropex1207", "C"): master_track20,
            ("25cropex1207", "L"): master_track20,
            ("25cropex1207", "X"): master_track20,
            ("25cropex1208", "C"): master_track20,
            ("25cropex1208", "L"): master_track20,
            ("25cropex1208", "X"): master_track20,
            ("25cropex1209", "C"): master_track20,
            ("25cropex1209", "L"): master_track20,
            ("25cropex1209", "X"): master_track20,
            ("25cropex1210", "C"): None,
            ("25cropex1210", "L"): None,
            ("25cropex1210", "X"): None,
            ("25cropex1211", "C"): master_track20,
            ("25cropex1211", "L"): master_track20,
            ("25cropex1211", "X"): master_track20,
            ("25cropex1214", "L"): master_track20,
            ("25cropex1214", "S"): master_track33,
            ("25cropex1214", "X"): None,
            ("25cropex1216", "L"): master_track20,
            ("25cropex1216", "S"): master_track33,
            ("25cropex1217", "L"): master_track20,
            ("25cropex1217", "S"): master_track33,
            ("25cropex1218", "L"): master_track20,
            ("25cropex1218", "S"): master_track33,
            ("25cropex1219", "L"): master_track20,
            ("25cropex1219", "S"): master_track33,
            ("25cropex1221", "C"): master_track20,
            ("25cropex1221", "L"): master_track20,
            ("25cropex1221", "X"): master_track20,
            ("25cropex1222", "C"): master_track20,
            ("25cropex1222", "L"): master_track20,
            ("25cropex1222", "X"): master_track20,
            ("25cropex1223", "C"): master_track20,
            ("25cropex1223", "L"): master_track20,
            ("25cropex1223", "X"): master_track20,
            ("25cropex1224", "C"): master_track20,
            ("25cropex1224", "L"): master_track20,
            ("25cropex1224", "X"): master_track20,
            ("25cropex1225", "C"): None,
            ("25cropex1225", "L"): None,
            ("25cropex1225", "X"): None,
            ("25cropex1302", "C"): master_track20,
            ("25cropex1302", "L"): master_track20,
            ("25cropex1302", "X"): master_track20,
            ("25cropex1303", "C"): master_track20,
            ("25cropex1303", "L"): master_track20,
            ("25cropex1303", "X"): master_track20,
            ("25cropex1304", "C"): master_track20,
            ("25cropex1304", "L"): master_track20,
            ("25cropex1304", "X"): master_track20,
            ("25cropex1305", "C"): master_track20,
            ("25cropex1305", "L"): master_track20,
            ("25cropex1305", "X"): master_track20,
            ("25cropex1306", "C"): master_track20,
            ("25cropex1306", "L"): master_track20,
            ("25cropex1306", "X"): master_track20,
            ("25cropex1307", "C"): master_track20,
            ("25cropex1307", "L"): master_track20,
            ("25cropex1307", "X"): master_track20,
            ("25cropex1308", "C"): master_track20,
            ("25cropex1308", "L"): master_track20,
            ("25cropex1308", "X"): master_track20,
            ("25cropex1309", "C"): master_track20,
            ("25cropex1309", "L"): master_track20,
            ("25cropex1309", "X"): master_track20,
            ("25cropex1310", "C"): master_track20,
            ("25cropex1310", "L"): master_track20,
            ("25cropex1310", "X"): master_track20,
            ("25cropex1311", "C"): None,
            ("25cropex1311", "L"): None,
            ("25cropex1311", "X"): None,
            ("25cropex1402", "C"): master_track20,
            ("25cropex1402", "L"): master_track20,
            ("25cropex1402", "X"): master_track20,
            ("25cropex1403", "C"): master_track20,
            ("25cropex1403", "L"): master_track20,
            ("25cropex1403", "X"): master_track20,
            ("25cropex1404", "C"): master_track20,
            ("25cropex1404", "L"): master_track20,
            ("25cropex1404", "X"): master_track20,
            ("25cropex1405", "C"): master_track20,
            ("25cropex1405", "L"): master_track20,
            ("25cropex1405", "X"): master_track20,
            ("25cropex1406", "C"): master_track20,
            ("25cropex1406", "L"): master_track20,
            ("25cropex1406", "X"): master_track20,
            ("25cropex1407", "C"): master_track20,
            ("25cropex1407", "L"): master_track20,
            ("25cropex1407", "X"): master_track20,
            ("25cropex1408", "C"): master_track20,
            ("25cropex1408", "L"): master_track20,
            ("25cropex1408", "X"): master_track20,
            ("25cropex1409", "C"): master_track20,
            ("25cropex1409", "L"): master_track20,
            ("25cropex1409", "X"): master_track20,
            ("25cropex1411", "L"): master_track20,
            ("25cropex1411", "S"): master_track33,
            ("25cropex1411", "X"): None,
            ("25cropex1413", "L"): master_track20,
            ("25cropex1413", "S"): master_track33,
            ("25cropex1414", "L"): master_track20,
            ("25cropex1414", "S"): master_track33,
            ("25cropex1415", "L"): master_track20,
            ("25cropex1415", "S"): master_track33,
            ("25cropex1416", "L"): master_track20,
            ("25cropex1416", "S"): master_track33,
            ("25cropex1419", "C"): master_track20,
            ("25cropex1419", "L"): master_track20,
            ("25cropex1419", "X"): master_track20,
            ("25cropex1420", "C"): None,
            ("25cropex1420", "L"): None,
            ("25cropex1420", "X"): None,
            ("25cropex1421", "C"): master_track20,
            ("25cropex1421", "L"): master_track20,
            ("25cropex1421", "X"): master_track20,
            ("25cropex1422", "C"): master_track20,
            ("25cropex1422", "L"): master_track20,
            ("25cropex1422", "X"): master_track20,
            ("25cropex1423", "C"): master_track20,
            ("25cropex1423", "L"): master_track20,
            ("25cropex1423", "X"): master_track20,
            ("25cropex1424", "C"): master_track20,
            ("25cropex1424", "L"): master_track20,
            ("25cropex1424", "X"): master_track20,
            ("25cropex1425", "C"): None,
            ("25cropex1425", "L"): None,
            ("25cropex1425", "X"): None,
            ("25cropex1502", "C"): master_track20,
            ("25cropex1502", "L"): master_track20,
            ("25cropex1502", "X"): master_track20,
            ("25cropex1503", "C"): master_track20,
            ("25cropex1503", "L"): master_track20,
            ("25cropex1503", "X"): master_track20,
            ("25cropex1504", "C"): master_track20,
            ("25cropex1504", "L"): master_track20,
            ("25cropex1504", "X"): master_track20,
            ("25cropex1505", "C"): master_track20,
            ("25cropex1505", "L"): master_track20,
            ("25cropex1505", "X"): master_track20,
            ("25cropex1506", "C"): master_track20,
            ("25cropex1506", "L"): master_track20,
            ("25cropex1506", "X"): master_track20,
            ("25cropex1507", "C"): master_track20,
            ("25cropex1507", "L"): master_track20,
            ("25cropex1507", "X"): master_track20,
            ("25cropex1508", "C"): master_track20,
            ("25cropex1508", "L"): master_track20,
            ("25cropex1508", "X"): master_track20,
            ("25cropex1509", "C"): master_track20,
            ("25cropex1509", "L"): master_track20,
            ("25cropex1509", "X"): master_track20,
            ("25cropex1510", "C"): None,
            ("25cropex1510", "L"): None,
            ("25cropex1510", "X"): None,
            ("25cropex1511", "C"): None,
            ("25cropex1511", "L"): None,
            ("25cropex1511", "X"): None,
            ("25cropex1514", "L"): master_track20,
            ("25cropex1514", "S"): master_track33,
            ("25cropex1514", "X"): None,
            ("25cropex1516", "L"): master_track20,
            ("25cropex1516", "S"): master_track33,
            ("25cropex1517", "L"): master_track20,
            ("25cropex1517", "S"): master_track33,
            ("25cropex1518", "L"): master_track20,
            ("25cropex1518", "S"): master_track33,
            ("25cropex1519", "L"): master_track20,
            ("25cropex1519", "S"): master_track33,
            ("25cropex1521", "C"): master_track20,
            ("25cropex1521", "L"): master_track20,
            ("25cropex1521", "X"): master_track20,
            ("25cropex1522", "C"): master_track20,
            ("25cropex1522", "L"): master_track20,
            ("25cropex1522", "X"): master_track20,
            ("25cropex1523", "C"): master_track20,
            ("25cropex1523", "L"): master_track20,
            ("25cropex1523", "X"): master_track20,
            ("25cropex1524", "C"): master_track20,
            ("25cropex1524", "L"): master_track20,
            ("25cropex1524", "X"): master_track20,
            ("25cropex1525", "C"): None,
            ("25cropex1525", "L"): None,
            ("25cropex1525", "X"): None,
            ("25cropex1602", "C"): None,
            ("25cropex1602", "L"): None,
            ("25cropex1602", "X"): None,
            ("25cropex1603", "C"): master_track20,
            ("25cropex1603", "L"): master_track20,
            ("25cropex1603", "X"): master_track20,
            ("25cropex1605", "C"): master_track20,
            ("25cropex1605", "L"): master_track20,
            ("25cropex1605", "X"): master_track20,
            ("25cropex1606", "C"): master_track20,
            ("25cropex1606", "L"): master_track20,
            ("25cropex1606", "X"): master_track20,
            ("25cropex1607", "C"): master_track20,
            ("25cropex1607", "L"): master_track20,
            ("25cropex1607", "X"): master_track20,
            ("25cropex1608", "C"): master_track20,
            ("25cropex1608", "L"): master_track20,
            ("25cropex1608", "X"): master_track20,
            ("25cropex1609", "C"): master_track20,
            ("25cropex1609", "L"): master_track20,
            ("25cropex1609", "X"): master_track20,
            ("25cropex1610", "C"): master_track20,
            ("25cropex1610", "L"): master_track20,
            ("25cropex1610", "X"): master_track20,
            ("25cropex1611", "C"): master_track20,
            ("25cropex1611", "L"): master_track20,
            ("25cropex1611", "X"): master_track20,
            ("25cropex1612", "C"): master_track20,
            ("25cropex1612", "L"): master_track20,
            ("25cropex1612", "X"): master_track20,
            ("25cropex1614", "L"): master_track20,
            ("25cropex1614", "S"): master_track33,
            ("25cropex1614", "X"): None,
            ("25cropex1616", "L"): master_track20,
            ("25cropex1616", "S"): master_track33,
            ("25cropex1617", "L"): master_track20,
            ("25cropex1617", "S"): master_track33,
            ("25cropex1618", "L"): master_track20,
            ("25cropex1618", "S"): master_track33,
            ("25cropex1619", "L"): master_track20,
            ("25cropex1619", "S"): master_track33,
            ("25cropex1621", "C"): master_track20,
            ("25cropex1621", "L"): master_track20,
            ("25cropex1621", "X"): master_track20,
            ("25cropex1622", "C"): master_track20,
            ("25cropex1622", "L"): master_track20,
            ("25cropex1622", "X"): master_track20,
            ("25cropex1623", "C"): master_track20,
            ("25cropex1623", "L"): master_track20,
            ("25cropex1623", "X"): master_track20,
            ("25cropex1624", "C"): master_track20,
            ("25cropex1624", "L"): master_track20,
            ("25cropex1624", "X"): master_track20,
            ("25cropex1625", "C"): None,
            ("25cropex1625", "L"): None,
            ("25cropex1625", "X"): None,
            ("25cropex1702", "C"): master_track20,
            ("25cropex1702", "L"): master_track20,
            ("25cropex1702", "X"): master_track20,
            ("25cropex1703", "C"): master_track20,
            ("25cropex1703", "L"): master_track20,
            ("25cropex1703", "X"): master_track20,
            ("25cropex1704", "C"): master_track20,
            ("25cropex1704", "L"): master_track20,
            ("25cropex1704", "X"): master_track20,
            ("25cropex1705", "C"): master_track20,
            ("25cropex1705", "L"): master_track20,
            ("25cropex1705", "X"): master_track20,
            ("25cropex1706", "C"): master_track20,
            ("25cropex1706", "L"): master_track20,
            ("25cropex1706", "X"): master_track20,
            ("25cropex1707", "C"): master_track20,
            ("25cropex1707", "L"): master_track20,
            ("25cropex1707", "X"): master_track20,
            ("25cropex1708", "C"): master_track20,
            ("25cropex1708", "L"): master_track20,
            ("25cropex1708", "X"): master_track20,
            ("25cropex1709", "C"): master_track20,
            ("25cropex1709", "L"): master_track20,
            ("25cropex1709", "X"): master_track20,
            ("25cropex1710", "C"): None,
            ("25cropex1710", "L"): None,
            ("25cropex1710", "X"): None,
            ("25cropex1711", "C"): master_track20,
            ("25cropex1711", "L"): master_track20,
            ("25cropex1711", "X"): master_track20,
            ("25cropex1714", "L"): master_track20,
            ("25cropex1714", "S"): master_track33,
            ("25cropex1714", "X"): None,
            ("25cropex1716", "L"): master_track20,
            ("25cropex1716", "S"): master_track33,
            ("25cropex1717", "L"): master_track20,
            ("25cropex1717", "S"): master_track33,
            ("25cropex1718", "L"): master_track20,
            ("25cropex1718", "S"): master_track33,
            ("25cropex1719", "L"): master_track20,
            ("25cropex1719", "S"): master_track33,
            ("25cropex1721", "C"): master_track20,
            ("25cropex1721", "L"): master_track20,
            ("25cropex1721", "X"): master_track20,
            ("25cropex1722", "C"): master_track20,
            ("25cropex1722", "L"): master_track20,
            ("25cropex1722", "X"): master_track20,
            ("25cropex1723", "C"): master_track20,
            ("25cropex1723", "L"): master_track20,
            ("25cropex1723", "X"): master_track20,
            ("25cropex1724", "C"): master_track20,
            ("25cropex1724", "L"): master_track20,
            ("25cropex1724", "X"): master_track20,
            ("25cropex1725", "C"): None,
            ("25cropex1725", "L"): None,
            ("25cropex1725", "X"): None,
            ("25cropex1802", "C"): None,
            ("25cropex1802", "L"): None,
            ("25cropex1802", "X"): None,
            ("25cropex1803", "C"): master_track20,
            ("25cropex1803", "L"): master_track20,
            ("25cropex1803", "X"): master_track20,
            ("25cropex1805", "C"): master_track20,
            ("25cropex1805", "L"): master_track20,
            ("25cropex1805", "X"): master_track20,
            ("25cropex1806", "C"): master_track20,
            ("25cropex1806", "L"): master_track20,
            ("25cropex1806", "X"): master_track20,
            ("25cropex1807", "C"): master_track20,
            ("25cropex1807", "L"): master_track20,
            ("25cropex1807", "X"): master_track20,
            ("25cropex1808", "C"): master_track20,
            ("25cropex1808", "L"): master_track20,
            ("25cropex1808", "X"): master_track20,
            ("25cropex1809", "C"): master_track20,
            ("25cropex1809", "L"): master_track20,
            ("25cropex1809", "X"): master_track20,
            ("25cropex1810", "C"): master_track20,
            ("25cropex1810", "L"): master_track20,
            ("25cropex1810", "X"): master_track20,
            ("25cropex1811", "C"): master_track20,
            ("25cropex1811", "L"): master_track20,
            ("25cropex1811", "X"): master_track20,
            ("25cropex1812", "C"): master_track20,
            ("25cropex1812", "L"): master_track20,
            ("25cropex1812", "X"): master_track20,
            ("25cropex1814", "L"): master_track20,
            ("25cropex1814", "S"): master_track33,
            ("25cropex1814", "X"): None,
            ("25cropex1816", "L"): master_track20,
            ("25cropex1816", "S"): master_track33,
            ("25cropex1817", "L"): master_track20,
            ("25cropex1817", "S"): master_track33,
            ("25cropex1818", "L"): master_track20,
            ("25cropex1818", "S"): master_track33,
            ("25cropex1819", "L"): master_track20,
            ("25cropex1819", "S"): master_track33,
            ("25cropex1821", "C"): master_track20,
            ("25cropex1821", "L"): master_track20,
            ("25cropex1821", "X"): master_track20,
            ("25cropex1822", "C"): master_track20,
            ("25cropex1822", "L"): master_track20,
            ("25cropex1822", "X"): master_track20,
            ("25cropex1823", "C"): master_track20,
            ("25cropex1823", "L"): master_track20,
            ("25cropex1823", "X"): master_track20,
            ("25cropex1824", "C"): master_track20,
            ("25cropex1824", "L"): master_track20,
            ("25cropex1824", "X"): master_track20,
            ("25cropex1825", "C"): None,
            ("25cropex1825", "L"): None,
            ("25cropex1825", "X"): None,
            ("25cropex1902", "C"): master_track20,
            ("25cropex1902", "L"): master_track20,
            ("25cropex1902", "X"): master_track20,
            ("25cropex1903", "C"): master_track20,
            ("25cropex1903", "L"): master_track20,
            ("25cropex1903", "X"): master_track20,
            ("25cropex1904", "C"): master_track20,
            ("25cropex1904", "L"): master_track20,
            ("25cropex1904", "X"): master_track20,
            ("25cropex1905", "C"): master_track20,
            ("25cropex1905", "L"): master_track20,
            ("25cropex1905", "X"): master_track20,
            ("25cropex1906", "C"): master_track20,
            ("25cropex1906", "L"): master_track20,
            ("25cropex1906", "X"): master_track20,
            ("25cropex1907", "C"): master_track20,
            ("25cropex1907", "L"): master_track20,
            ("25cropex1907", "X"): master_track20,
            ("25cropex1908", "C"): master_track20,
            ("25cropex1908", "L"): master_track20,
            ("25cropex1908", "X"): master_track20,
            ("25cropex1909", "C"): master_track20,
            ("25cropex1909", "L"): master_track20,
            ("25cropex1909", "X"): master_track20,
            ("25cropex1910", "C"): master_track20,
            ("25cropex1910", "L"): master_track20,
            ("25cropex1910", "X"): master_track20,
            ("25cropex1911", "C"): master_track20,
            ("25cropex1911", "L"): master_track20,
            ("25cropex1911", "X"): master_track20,
            ("25cropex1913", "C"): master_track20,
            ("25cropex1913", "L"): master_track20,
            ("25cropex1913", "X"): master_track20,
            ("25cropex1914", "C"): None,
            ("25cropex1914", "L"): None,
            ("25cropex1914", "X"): None,
            ("25cropex1916", "L"): master_track20,
            ("25cropex1916", "S"): master_track33,
            ("25cropex1916", "X"): None,
            ("25cropex1918", "L"): master_track20,
            ("25cropex1918", "S"): master_track33,
            ("25cropex1919", "L"): master_track20,
            ("25cropex1919", "S"): master_track33,
            ("25cropex1920", "L"): master_track20,
            ("25cropex1920", "S"): master_track33,
            ("25cropex1921", "L"): master_track20,
            ("25cropex1921", "S"): master_track33,
            ("25cropex1923", "C"): master_track20,
            ("25cropex1923", "L"): master_track20,
            ("25cropex1923", "X"): master_track20,
            ("25cropex1924", "C"): master_track20,
            ("25cropex1924", "L"): master_track20,
            ("25cropex1924", "X"): master_track20,
            ("25cropex1925", "C"): None,
            ("25cropex1925", "L"): None,
            ("25cropex1925", "X"): None,
            ("25cropex2002", "C"): master_track20,
            ("25cropex2002", "L"): master_track20,
            ("25cropex2002", "X"): master_track20,
            ("25cropex2003", "C"): master_track20,
            ("25cropex2003", "L"): master_track20,
            ("25cropex2003", "X"): master_track20,
            ("25cropex2004", "C"): master_track20,
            ("25cropex2004", "L"): master_track20,
            ("25cropex2004", "X"): master_track20,
            ("25cropex2005", "C"): master_track20,
            ("25cropex2005", "L"): master_track20,
            ("25cropex2005", "X"): master_track20,
            ("25cropex2006", "C"): master_track20,
            ("25cropex2006", "L"): master_track20,
            ("25cropex2006", "X"): master_track20,
            ("25cropex2007", "C"): master_track20,
            ("25cropex2007", "L"): master_track20,
            ("25cropex2007", "X"): master_track20,
            ("25cropex2008", "C"): master_track20,
            ("25cropex2008", "L"): master_track20,
            ("25cropex2008", "X"): master_track20,
            ("25cropex2009", "C"): master_track20,
            ("25cropex2009", "L"): master_track20,
            ("25cropex2009", "X"): master_track20,
            ("25cropex2010", "C"): master_track20,
            ("25cropex2010", "L"): master_track20,
            ("25cropex2010", "X"): master_track20,
            ("25cropex2011", "C"): master_track20,
            ("25cropex2011", "L"): master_track20,
            ("25cropex2011", "X"): master_track20,
            ("25cropex2012", "C"): master_track20,
            ("25cropex2012", "L"): master_track20,
            ("25cropex2012", "X"): master_track20,
            ("25cropex2014", "C"): master_track20,
            ("25cropex2014", "L"): master_track20,
            ("25cropex2014", "X"): master_track20,
            ("25cropex2015", "C"): None,
            ("25cropex2015", "L"): None,
            ("25cropex2015", "X"): None,
            ("25cropex2017", "L"): master_track20,
            ("25cropex2017", "S"): master_track33,
            ("25cropex2017", "X"): None,
            ("25cropex2019", "L"): master_track20,
            ("25cropex2019", "S"): master_track33,
            ("25cropex2020", "L"): master_track20,
            ("25cropex2020", "S"): master_track33,
            ("25cropex2021", "L"): master_track20,
            ("25cropex2021", "S"): master_track33,
            ("25cropex2022", "L"): master_track20,
            ("25cropex2022", "S"): master_track33,
            ("25cropex2024", "C"): master_track20,
            ("25cropex2024", "L"): master_track20,
            ("25cropex2024", "X"): master_track20,
            ("25cropex2025", "C"): master_track20,
            ("25cropex2025", "L"): master_track20,
            ("25cropex2025", "X"): master_track20,
            ("25cropex2026", "C"): None,
            ("25cropex2026", "L"): None,
            ("25cropex2026", "X"): None,
            ("25cropex2102", "C"): master_track20,
            ("25cropex2102", "L"): master_track20,
            ("25cropex2102", "X"): master_track20,
            ("25cropex2103", "C"): master_track20,
            ("25cropex2103", "L"): master_track20,
            ("25cropex2103", "X"): master_track20,
            ("25cropex2104", "C"): None,
            ("25cropex2104", "L"): None,
            ("25cropex2104", "X"): None,
            ("25cropex2105", "C"): master_track20,
            ("25cropex2105", "L"): master_track20,
            ("25cropex2105", "X"): master_track20,
            ("25cropex2106", "C"): master_track20,
            ("25cropex2106", "L"): master_track20,
            ("25cropex2106", "X"): master_track20,
            ("25cropex2107", "C"): master_track20,
            ("25cropex2107", "L"): master_track20,
            ("25cropex2107", "X"): master_track20,
            ("25cropex2108", "C"): master_track20,
            ("25cropex2108", "L"): master_track20,
            ("25cropex2108", "X"): master_track20,
            ("25cropex2109", "C"): master_track20,
            ("25cropex2109", "L"): master_track20,
            ("25cropex2109", "X"): master_track20,
            ("25cropex2110", "C"): master_track20,
            ("25cropex2110", "L"): master_track20,
            ("25cropex2110", "X"): master_track20,
            ("25cropex2111", "C"): master_track20,
            ("25cropex2111", "L"): master_track20,
            ("25cropex2111", "X"): master_track20,
            ("25cropex2202", "C"): None,
            ("25cropex2202", "L"): None,
            ("25cropex2202", "X"): None,
            ("25cropex2203", "C"): master_track20,
            ("25cropex2203", "L"): master_track20,
            ("25cropex2203", "X"): master_track20,
            ("25cropex2205", "C"): master_track20,
            ("25cropex2205", "L"): master_track20,
            ("25cropex2205", "X"): master_track20,
            ("25cropex2206", "C"): master_track20,
            ("25cropex2206", "L"): master_track20,
            ("25cropex2206", "X"): master_track20,
            ("25cropex2207", "C"): master_track20,
            ("25cropex2207", "L"): master_track20,
            ("25cropex2207", "X"): master_track20,
            ("25cropex2208", "C"): master_track20,
            ("25cropex2208", "L"): master_track20,
            ("25cropex2208", "X"): master_track20,
            ("25cropex2209", "C"): master_track20,
            ("25cropex2209", "L"): master_track20,
            ("25cropex2209", "X"): master_track20,
            ("25cropex2210", "C"): master_track20,
            ("25cropex2210", "L"): master_track20,
            ("25cropex2210", "X"): master_track20,
            ("25cropex2302", "C"): None,
            ("25cropex2302", "L"): None,
            ("25cropex2302", "X"): None,
            ("25cropex2303", "C"): master_track20,
            ("25cropex2303", "L"): master_track20,
            ("25cropex2303", "X"): master_track20,
            ("25cropex2305", "C"): master_track20,
            ("25cropex2305", "L"): master_track20,
            ("25cropex2305", "X"): master_track20,
            ("25cropex2306", "C"): master_track20,
            ("25cropex2306", "L"): master_track20,
            ("25cropex2306", "X"): master_track20,
            ("25cropex2307", "C"): master_track20,
            ("25cropex2307", "L"): master_track20,
            ("25cropex2307", "X"): master_track20,
            ("25cropex2308", "C"): master_track20,
            ("25cropex2308", "L"): master_track20,
            ("25cropex2308", "X"): master_track20,
            ("25cropex2309", "C"): master_track20,
            ("25cropex2309", "L"): master_track20,
            ("25cropex2309", "X"): master_track20,
            ("25cropex2310", "C"): master_track20,
            ("25cropex2310", "L"): master_track20,
            ("25cropex2310", "X"): master_track20,
            ("25cropex2311", "C"): master_track20,
            ("25cropex2311", "L"): master_track20,
            ("25cropex2311", "X"): master_track20,
            ("25cropex2312", "C"): master_track20,
            ("25cropex2312", "L"): master_track20,
            ("25cropex2312", "X"): master_track20,
            ("25cropex2314", "L"): master_track20,
            ("25cropex2314", "S"): master_track33,
            ("25cropex2314", "X"): None,
            ("25cropex2317", "L"): master_track20,
            ("25cropex2317", "S"): master_track33,
            ("25cropex2318", "L"): master_track20,
            ("25cropex2318", "S"): master_track33,
            ("25cropex2319", "L"): master_track20,
            ("25cropex2319", "S"): master_track33,
            ("25cropex2320", "L"): master_track20,
            ("25cropex2320", "S"): master_track33,
            ("25cropex2322", "C"): master_track20,
            ("25cropex2322", "L"): master_track20,
            ("25cropex2322", "X"): master_track20,
            ("25cropex2323", "C"): master_track20,
            ("25cropex2323", "L"): master_track20,
            ("25cropex2323", "X"): master_track20,
            ("25cropex2324", "C"): master_track20,
            ("25cropex2324", "L"): master_track20,
            ("25cropex2324", "X"): master_track20,
            ("25cropex2325", "C"): master_track20,
            ("25cropex2325", "L"): master_track20,
            ("25cropex2325", "X"): master_track20,
            ("25cropex2326", "C"): None,
            ("25cropex2326", "L"): None,
            ("25cropex2326", "X"): None,
        }

    def get_pass(self, pass_name, band):
        master_name = self._pass_band_to_master.get((pass_name, band), None)
        return CROPEX25Pass(self.campaign_folder, pass_name, band, master_name, try_folder=self.try_folder)

    def get_all_pass_names(self, band):
        pass_names = [pass_name for pass_name, ps_b in self._pass_band_to_master.keys() if ps_b == band]
        return sorted(list(set(pass_names)))  # sort and de-duplicate


class CROPEX25Pass:
    def __init__(self, campaign_folder, pass_name, band, master_name=None, try_folder="t01"):
        self.campaign_folder = pathlib.Path(campaign_folder)
        self.pass_name = pass_name
        self.band = band
        self.master_name = master_name
        self.try_folder = try_folder

    # RGI folder

    def load_rgi_slc(self, pol, antenna=""):
        """
        Load SLC in specified polarization ("hh", "hv", "vh", "vv") from the RGI folder.
        Multiple antennas are available for selected passes, the antenna ID can be specified with `antenna`.
        """
        return fc.mrrat(
            self._rgi_folder() / "RGI-SR" / f"slc_{self.pass_name}_{self.band}{antenna}{pol}_{self.try_folder}{self.band}.rat"
        )

    def load_rgi_incidence(self, pol=None):
        """
        Load incidence angle from the RGI folder.
        Polarization is ignored for the CROPEX 25 campaign.
        """
        return fc.mrrat(self._rgi_folder() / "RGI-SR" / f"incidence_{self.pass_name}_{self.band}_{self.try_folder}{self.band}.rat")

    def load_rgi_params(self, pol="hh"):
        """
        Load radar parameters from the RGI folder. Default polarization is "hh".
        """
        return campaign_utils.parse_xml_parameters(
            self._rgi_folder() / "RGI-RDP" / f"pp_{self.pass_name}_{self.band}{pol}_{self.try_folder}{self.band}.xml"
        )

    # INF folder

    def load_inf_slc(self, pol, antenna=""):
        """
        Load coregistered SLC in specified polarization ("hh", "hv", "vh", "vv") from the INF folder.
        Multiple antennas are available for selected passes, the antenna ID combination can be specified with `antenna`.
        """
        print(self._inf_folder()
            / "INF-SR"
            / f"slc_coreg_{self.master_name}_{self.pass_name}_{self.band}{antenna}{pol}_{self.try_folder}{self.band}.rat")

        return fc.mrrat(
            self._inf_folder()
            / "INF-SR"
            / f"slc_coreg_{self.master_name}_{self.pass_name}_{self.band}{antenna}{pol}_{self.try_folder}{self.band}.rat"
        )

    def load_inf_pha_dem(self, pol=None):
        """
        Load interferometric phase correction derived from track and terrain geometry.
        The residual can be used to correct the phase of the coregistered SLCs: coreg_slc * np.exp(1j * phase)
        This is equivalent of subtracting the phase from the interferogram.
        Polarization is ignored for the CROPEX 25 campaign.
        """
        return fc.mrrat(
            self._inf_folder()
            / "INF-SR"
            / f"pha_dem_{self.master_name}_{self.pass_name}_{self.band}_{self.try_folder}{self.band}.rat"
        )

    def load_inf_pha_fe(self, pol=None):
        """
        Load interferometric flat-Earth phase.
        For the CROPEX 25 campaign, this phase is included into pha_dem and pha_fe is 0.
        Polarization is ignored for the CROPEX 25 campaign.
        """
        return fc.mrrat(
            self._inf_folder() / "INF-SR" / f"pha_fe_{self.master_name}_{self.pass_name}_{self.band}_{self.try_folder}{self.band}.rat"
        )

    def load_inf_kz(self, pol, antenna=""):
        """
        Load interferometric kz.
        Multiple antennas are available for selected passes, the antenna ID combination can be specified with `antenna`.
        """
        return fc.mrrat(
            self._inf_folder()
            / "INF-SR"
            / f"kz_{self.master_name}_{self.pass_name}_{self.band}{antenna}{pol}_{self.try_folder}{self.band}.rat"
        )

    def load_inf_params(self, pol="hh"):
        """
        Load radar parameters from the INF folder. Default polarization is "hh".
        """
        return campaign_utils.parse_xml_parameters(
            self._inf_folder() / "INF-RDP" / f"pp_{self.pass_name}_{self.band}{pol}_{self.try_folder}{self.band}.xml"
        )

    def load_inf_insar_params(self, pol="hh"):
        """
        Load insar radar parameters from the INF folder. Default polarization is "hh".
        """
        return campaign_utils.parse_xml_parameters(
            self._inf_folder()
            / "INF-RDP"
            / f"ppinsar_{self.master_name}_{self.pass_name}_{self.band}{pol}_{self.try_folder}{self.band}.xml"
        )

    # GTC folder

    def load_gtc_sr2ell_lut(self):
        """
        Return the geocoding lookup table (LUT).
        Geographical Axes: latitude, longitude.
        Orientations: north, east.
        UoM: degree
        """
        fname_lut_az = self._gtc_folder() / "GTC-LUT" / f"sr2ell_az_{self.pass_name}_{self.band}_{self.try_folder}{self.band}.tif"
        fname_lut_rg = self._gtc_folder() / "GTC-LUT" / f"sr2ell_rg_{self.pass_name}_{self.band}_{self.try_folder}{self.band}.tif"
        with rasterio.open(fname_lut_az) as file_az:
            transform = file_az.transform
            crs = file_az.crs
            lut_az = file_az.read(1)
        with rasterio.open(fname_lut_rg) as file_rg:
            lut_rg = file_rg.read(1)
        lut = fc.SlantRange2Geo(lut_az=lut_az, lut_rg=lut_rg, crs=crs, transform=transform)
        return lut

    # Helpers

    def _rgi_folder(self):
        flight_id, pass_id = campaign_utils.get_flight_and_pass_ids(self.pass_name)
        try_folder = self.try_folder.upper()
        rgi_folder = "RGI" if self.try_folder == "t01" else "RGI/RGI"
        return self.campaign_folder / f"FL{flight_id}/PS{pass_id}/{try_folder}{self.band}/{rgi_folder}"

    def _inf_folder(self):
        flight_id, pass_id = campaign_utils.get_flight_and_pass_ids(self.pass_name)
        try_folder = self.try_folder.upper()
        pass_folder = self.campaign_folder / f"FL{flight_id}/PS{pass_id}/{try_folder}{self.band}"
        if self.try_folder == "t01":
            triple_flights = {
                "04": "04-05-06",
                "05": "04-05-06",
                "06": "04-05-06",
                "11": "11-12-13",
                "12": "11-12-13",
                "13": "11-12-13",
                "21": "21-22",
                "22": "21-22",
                "23": "23",
            }
            if flight_id in triple_flights:

                return pass_folder / f"INF_{triple_flights[flight_id]}"
            else:
                return pass_folder / f"INF_{flight_id}"
        else:            
            return pass_folder / "INF_20/INF_20"


    def _gtc_folder(self):
        flight_id, pass_id = campaign_utils.get_flight_and_pass_ids(self.pass_name)
        try_folder = self.try_folder.upper()
        gtc_folder = "GTC" if self.try_folder == "t01" else "GTC/GTC"
        return self.campaign_folder / f"FL{flight_id}/PS{pass_id}/{try_folder}{self.band}/{gtc_folder}"

    def __repr__(self):
        return f"{self.pass_name}_{self.band}"



if __name__ == "__main__":
    def main():
        camp = CROPEX25Campaign(fc.get_polinsar_folder() / "01_projects/25CROPEX", try_folder="t10")

        ps = camp.get_pass("25cropex0905", "L")
        rgi_slc = ps.load_rgi_slc("hh")
        print(rgi_slc.shape)
        inf_slc = ps.load_inf_slc("hh")
        print(inf_slc.shape)
        lut = ps.load_gtc_sr2ell_lut()
        print(lut.lut_az.shape)

    main()