def __init__(self, IN_pixc_main_file):

        # 1 - Retrieve needed information from pixel cloud main file
        sensor_main = myCdf.myNcReader(IN_pixc_main_file)
        # 1.1 - Number of pixels in range dimension
        self.altitude = sensor_main.getVarValue("altitude")
        # 1.1 - Number of pixels in range dimension
        self.azimuth_spacing = sensor_main.getAttValue("azimuth_spacing")
Пример #2
0
    def __init__(self, IN_gdem_file, list_landtype_flags):
      
        gdem_main = myCdf.myNcReader(IN_gdem_file, dim=2)
        df, nb_lon, nb_lat = gdem_main.getVarValue2d('longitude', 'latitude')
        self.dataframe = df
        self.nb_lon = nb_lon
        self.nb_lat = nb_lat
        
        print("Calcul des longitudes et latitudes du gdem")
                
        self.elevation = self.dataframe.elevation.values.reshape(self.nb_lat,  self.nb_lon)
        self.landtype = self.dataframe.landtype.values.reshape(self.nb_lat,  self.nb_lon)

        self.longitude = self.dataframe.longitude.values
        self.latitude = self.dataframe.latitude.values
Пример #3
0
    def __init__(self, IN_pixc_main_file, list_classif_flags):

        # 1 - Retrieve needed information from pixel cloud main file
        pixc_main = myCdf.myNcReader(IN_pixc_main_file)
        # 1.1 - Number of pixels in range dimension
        self.nr_pixels = pixc_main.getAttValue("nr_pixels")
        # 1.2 - Number of pixels in azimuth dimension
        self.nr_lines = pixc_main.getAttValue("nr_lines")
        #~ # 1.3 - Cycle number
        #~ self.cycle_num = pixc_main.getAttValue("cycle_number")
        #~ # 1.4 - Pass number
        #~ self.pass_num = pixc_main.getAttValue("pass_number")
        #~ # 1.5 - Tile reference
        #~ self.tile_ref = pixc_main.getAttValue("tile_ref")
        # 1.6 - Classification flag
        self.classif = pixc_main.getVarValue("classification")

        # Get indices corresponding to input classification flags
        TMP_classif = self.classif  # Init temporary classif vector

        self.selected_idx = None  # Init wanted indices vector
        self.nb_selected = 0

        for classif_flag in list_classif_flags:
            vInd = np.where(TMP_classif == int(classif_flag))[0]
            print("[PixelCloud] %d pixels with classification flag = %d" %
                  (vInd.size, int(classif_flag)))
            if (vInd.size != 0):
                if (self.nb_selected == 0):
                    self.selected_idx = vInd
                    self.nb_selected += vInd.size
                else:
                    self.selected_idx = np.array(
                        list(itertools.chain(self.selected_idx, vInd)))
                    self.nb_selected += vInd.size
        self.nb_selected = self.selected_idx.size
        print("[PixelCloud] => %d pixels to keep" % (self.nb_selected))

        # Keep PixC data only for selected pixels
        if (self.nb_selected != 0):
            # 1.7 - Range indices of water pixels
            self.range_idx = pixc_main.getVarValue("range_index")[
                self.selected_idx]
            # Number of water pixels
            self.nb_water_pix = self.range_idx.size
            # 1.8 - Azimuth indices of water pixels
            self.azimuth_idx = pixc_main.getVarValue("azimuth_index")[
                self.selected_idx]
            # 1.12 - Pixel area
            self.pixel_area = pixc_main.getVarValue("pixel_area")[
                self.selected_idx]
            # 1.14 - Longitude
            self.longitude = pixc_main.getVarValue("longitude")[
                self.selected_idx]
            # 1.15 - Latitude
            self.latitude = pixc_main.getVarValue("latitude")[
                self.selected_idx]
            # 1.16 - Height
            self.height = pixc_main.getVarValue("height")[self.selected_idx]

        pixc_main.close()
import profile


def normalize(vect):
    norm = np.sqrt(np.dot(vect, vect))
    return vect / norm  #don t use me with np.zeroes(#)


## last JPL version
input_intf_path = "/work/ALT/swot/swotdev/SIMU_JPL/simu_US_land_-5dB/simu1/output/0001/cycle_0001_pass_0107_RightSwath_nlcd50_darkWater_25m_CBE/intf_truth.RightSwath.nc"
input_sensor_path = "/work/ALT/swot/swotdev/SIMU_JPL/simu_US_land_-5dB/simu1/output/0001/cycle_0001_pass_0107_RightSwath_nlcd50_darkWater_25m_CBE/sensor.nc"
## november binaries, SAM simulator
#~ input_intf_path = "/work/ALT/swot/swothr/users/desrochesd/runs/old/test_liv12_06.ref/makeInterferogramJPL_1.01/outputs/intf_test.LeftSwath.nc"
#~ input_sensor_path = "/work/ALT/swot/swothr/users/desrochesd/runs/old/test_liv12_06.ref/makeSensor_2.00/outputs/sensorfile.nc"

intf_main = myCdf.myNcReader(input_intf_path, dim=2)
df, nb_az, nb_rg = intf_main.getVarValue2d('record', 'nr_pixels')
dataframe = df

near_range = intf_main.content.attrs['near_range']
range_spacing = intf_main.content.attrs['range_spacing']

no_layover_x = dataframe.no_layover_x.values.reshape(nb_rg, nb_az)
no_layover_y = dataframe.no_layover_y.values.reshape(nb_rg, nb_az)
no_layover_z = dataframe.no_layover_z.values.reshape(nb_rg, nb_az)
height = dataframe.height.values.reshape(nb_rg, nb_az)

sensor_main = myCdf.myNcReader(input_sensor_path)
x_sensor = sensor_main.getVarValue("x")
y_sensor = sensor_main.getVarValue("y")
z_sensor = sensor_main.getVarValue("z")