getcity module
- getcity.adjust_longitude(longitude)
- getcity.calculate_polygon_area(latitude_longitude_coords)
- getcity.closest(data, v)
find the nearest urban grid cell in CESM using haversine distance reference: https://stackoverflow.com/questions/41336756/find-the-closest-latitude-and-longitude
- Parameters:
- datadict
a dict of cities’ lat and lon, from get_mask_cities
- vdict
a dict of a city’s lat and lon that we are interested in, e.g., {‘lat’: 40.1164, ‘lon’: -88.2434}
- Returns:
- dict
lat and lon of the nearest grid cell in Earth System Model
- getcity.get_mask_cities(df_mask)
This is a function for getting urban mask and a list of cities’ lat and lon
- Parameters:
- maskxarray.DataArray
urban mask
- Returns:
- dict
a dict of cities’ lat and lon
- getcity.haversine_dist(a, b)
This is a function for getting the haversine distance
- Parameters:
- a: list
[lat, lon] e.g., (45.7597, 4.8422)
- b: list
[lat, lon] e.g., (48.8567, 2.3508)
- er:
Earth radius, default is 6371.0088 km
- Returns:
- haversine_dist
the haversine distance between a and b