nansat icon indicating copy to clipboard operation
nansat copied to clipboard

get_min_max_lat_lon method

Open korvinos opened this issue 7 years ago • 0 comments

I can see several cases where to get max/min/ lat/lon values method get_corners (with max() min()) was used. According to the code (Domain) get_corners and get_min_max_lat_lon methods work by the different way. Could anybody tell me, please, can I just use one of them (everywhere for this aim), or are there some deep and important differences?

def get_corners(self):
    colVector = [0, 0, self.vrt.dataset.RasterXSize, self.vrt.dataset.RasterXSize]
    rowVector = [0, self.vrt.dataset.RasterYSize, 0, self.vrt.dataset.RasterYSize]
    return self.transform_points(colVector, rowVector)
def get_min_max_lat_lon(self):
    allLongitudes, allLatitudes = self.get_geolocation_grids()
    maxLat = -90
    minLat = 90
    for latitudes in allLatitudes:
            for lat in latitudes:
                if lat > maxLat:
                    maxLat = lat
                if lat < minLat:
                    minLat = lat
    maxLon = -180
    minLon = 180
    for longitudes in allLongitudes:
        for lon in longitudes:
            if lon > maxLon:
                maxLon = lon
            if lon < minLon:
                minLon = lon
    
    return minLat, maxLat, minLon, maxLon

korvinos avatar Jan 16 '18 09:01 korvinos