reskit.util.weather_tile
========================

.. py:module:: reskit.util.weather_tile


Functions
---------

.. autoapisummary::

   reskit.util.weather_tile.get_tile_XY
   reskit.util.weather_tile.get_dataframe_with_weather_tilepaths


Module Contents
---------------

.. py:function:: get_tile_XY(zoom, lon=None, lat=None, geom=None)

   Returns the X/Y id of the respective tile for a given
   latitude and longitude and tile No.

   Params:
   ======
   zoom : zoom level for tiling
   lon : longitude point to consider, only if geom not given
   lat : latitude point to consider, only if geom not given
   geom : point geom of type osgeo.ogr.Geometry, only if not lat and lon are given, else None

   Return:
   ======
   tuple
       - (X, Y)


.. py:function:: get_dataframe_with_weather_tilepaths(placements, weather_path, zoom)

   This method will generate a dataframe from a list of input placements
   and add the link to the corresponding weather data tile in a new dataframe
   column 'source'.

   placements : pd.DataFrame with 'geom' column and osgeo.ogr.Geometry point
   objects in EPSG:4326 or 'lat' and 'lon' columns with degrees in EPSG:4326.
   weather_path : The path to the tilepath or a dummy path containing '<X-TILE>'
   and '<Y-TILE>', optionally also <ZOOM> as spacers. These will be replaced by
   the actual tile ID in x and y direction, plus zoom value if applicable.
   weather_path can also be None only if 'source' is an existing attribute of the
   placements dataframe, the column values will be assumed as existing filepaths
   of weather data tiles then.
   in placements dataframe or if no '<ZOOM>' spacer in weather_path.


