surface = []

                f = open(file, 'r')
                for line in f:
                    line = line.strip()
                    columns = line.split()
                    # If data point is from open ocean (1) or from a lead (2)
                    if columns[0] == '1' or columns[0] == '2':
                        # If data point is listed as 'valid'
                        if columns[1] == '1':
                            lat.append(float(columns[5]))
                            lon.append(float(columns[6]))
                            ssha.append((float(columns[7]) - float(columns[8])))
                            surface.append(int(columns[0]))

                tracker_type = funct.mode_points(lat, lon, month)
                
                for point in range(len(tracker_type)):
                    if tracker_type[point] == 1 and surface[point] == '1':
                        ssha[point] += funct.apply_offset(month, 'SAR')

                # Find the boundaries
                iedge_ocean_ice = []
                for it in range(len(surface)):
                    # Find ice boundaries
                    if surface[it:it + len_bound] == ocean_to_ice:
                        iedge_ocean_ice.append(it + len_bound//2)
                    elif surface[it:it + len_bound] == ice_to_ocean:
                        iedge_ocean_ice.append(it + len_bound//2)

                for step in iedge_ocean_ice:
                surface_type = []

                f = open(file, 'r')
                for line in f:
                    line = line.strip()
                    columns = line.split()
                    # If data point is from open ocean (1) or from a lead (2)
                    if columns[0] == '1' or columns[0] == '2':
                        # If data point is listed as 'valid'
                        if columns[1] == '1':
                            lat.append(float(columns[5]))
                            lon.append(float(columns[6]))
                            ssha.append(float(columns[7]) - float(columns[8]))
                
                # Generate a list of retracker modes for this track
                surface_type = funct.mode_points(lat, lon, month)

                iedge_SAR = []
                iedge_SARIn = []
                for it in range(len(surface_type)):
                    if surface_type[it:it + Len_SAR] == SAR_edge:
                        iedge_SAR.append(it + Len_SAR//2)
                    elif surface_type[it:it + Len_SAR] == SAR_edge2:
                        iedge_SAR.append(it + Len_SAR//2)

                    elif surface_type[it:it + Len_SARIn] == SARIn_edge:
                        iedge_SARIn.append(it + Len_SARIn//2)
                    elif surface_type[it:it + Len_SARIn] == SARIn_edge2:
                        iedge_SARIn.append(it + Len_SARIn//2)

                for step in iedge_SAR:
Beispiel #3
0
                        line.strip()
                        columns = line.split()
                        lat_asc_filt.append(float(columns[0]))
                        ssha_asc_filt.append(float(columns[1]))
                    output_ssh.close()

                    os.system('rm ../OUTPUT_ssh.dat')

                    lat = list(lat_desc_filt) + list(lat_asc_filt)
                    ssha = list(ssha_desc_filt) + list(ssha_asc_filt)
                    lon = list(lon_desc) + list(lon_asc)
                    surface = list(surface_desc) + list(surface_asc)

                    if len(lat) == len(lon):
                        # Generate a list of retracker modes for this track
                        tracker_type = funct.mode_points(lat, lon, month)

                        # Find the boundaries
                        iedge_LRM_SAR = []
                        for it in range(len(tracker_type)):
                            # Find retracker boundaries
                            if tracker_type[it:it + len_bound] == LRM_to_SAR:
                                iedge_LRM_SAR.append(it + len_bound // 2)
                            elif tracker_type[it:it + len_bound] == SAR_to_LRM:
                                iedge_LRM_SAR.append(it + len_bound // 2)

                        # For the LRM-SAR boundary
                        for step in iedge_LRM_SAR:
                            # If the boundary is ALL OCEAN
                            if surface[step - len_bound // 2:step +
                                       len_bound // 2] == [1] * len_bound: