from_latlon_2d#
- from_latlon_2d(lat, lon, level=None, adapt_level=False, fill_value_in=None, fill_value_out=None)#
Coverts latitudes and longitudes to SIDs. In contrary to
from_latlon(), this function accepts 2D arrays as latitude and longitude inputs. This is e.g. convenient to convert the geolocation of Level1/2 swath granules to SIDs. Additionally, this function allows to adapt the stare level of each generated SID to match the resolution of the geolocations.- Parameters:
- lat: 2D array-like
latitudes. Has to have same length as lon
- lon: 2D array-like
longitudes. Has to have same length as lat
- level: int (0<=level<=27)
level of the SIDs. If not set, level will me automatically adapted. If set, adapt_level will be set to false.
- adapt_level: bool
if True, level will adapted to match resolution of lat/lon. Will overwrite level.
- fill_value_in: STARE indices are not calculated for lat/lon of this value
- fill_value_out: set indices to this value where lat/lon is fill_value_in
- Returns:
- sids: 2D numpy array
stare index values
Examples
>>> lats = numpy.array([[53.20177841, 53.20317078, 53.20351791], [53.29219437, 53.29222107, 53.29125977], [53.28958893, 53.29105759, 53.29147339]]) >>> lons = numpy.array([[-15.9339962 , -16.2881012 , -16.62910461], [-15.93274784, -16.28762245, -16.62934113], [-15.93699169, -16.29188538, -16.63365936]]) >>> pystare.from_latlon_2d(lats, lons, adapt_level=True) array([[4298473764500464809, 4298458168380511209, 4297394569014717897], [4298462872969244297, 4298459225563237225, 4297297422977447753], [4298462873435275369, 4298459227962358473, 4297297429637206121]])
>>> pystare.from_latlon_2d(lats, lons, level=20, adapt_level=False) array([[4298473764500464820, 4298458168380511220, 4297394569014717908], [4298462872969244308, 4298459225563237236, 4297297422977447764], [4298462873435275380, 4298459227962358484, 4297297429637206132]])