latlon-utils

Retrieve WorldClim climate and other information for lat-lon grid cells

GPL-3.0 License

Downloads
197
Stars
6
Committers
4
latlon-utils - Fixed download URLs Latest Release

Published by Chilipp almost 3 years ago

This release fixes the download URLs for Woldclim (thanks @klondenberg-vw, see #1), and natural earth (see #2).

latlon-utils - latlon-utils v0.0.2: Revised command line download

Published by Chilipp over 5 years ago

Build Status

This patch includes a minor update to fix a bug when downloading data from the command line.

latlon-utils - latlon-utils v0.0.1: A package for retrieving latlon specific information

Published by Chilipp over 5 years ago

Build Status

This python package is supposed to deliver information specific to a given latitude and longitude.

This first release contains the get_climate method to retrieve climate data from the WorldClim 2.0 and the get_country method to retrieve the country based on the datasets/geo-countries repository.

Example usage

Get the country for 50 degrees north and 10 degrees east:

>>> from latlon_utils import get_country

>>> get_country(50, 10)
'Germany'

Get the climate for 50 degrees north and 10 degrees east:

>>> from latlon_utils import get_climate

# limit the number of columns printed by pandas
>>> import pandas; pandas.options.display.max_columns = 5

>>> get_climate(50, 10)
tavg  jan     0.044739
      feb     0.974976
      mar     4.705505
      apr     8.232239
      mai    13.150024
      jun    16.012268
      jul    17.958984
      aug    17.828735
      sep    13.779480
      oct     8.787476
      nov     4.039001
      dec     1.430237
      djf     0.816650
      mam     8.695923
      jja    17.266663
      son     8.868652
      ann     8.911972
prec  jan    48.000000
      feb    42.000000
      mar    44.000000
      apr    44.000000
      mai    56.000000
      jun    68.000000
      jul    65.000000
      aug    52.000000
      sep    47.000000
      oct    52.000000
      nov    52.000000
      dec    59.000000
      djf    49.666667
      mam    48.000000
      jja    61.666667
      son    50.333333
      ann    52.416667
Name: (50, 10), dtype: float64


>>> get_climate(50, 10)['tavg', 'djf']
0.816650390625

>>> get_climate([10, 11], [50, 51])
            tavg             ...       prec
             jan        feb  ...        son       ann
lat lon                        ...
10  50   21.810730  22.687988  ...  10.666667  6.833333
11  51   18.416992  19.715759  ...  10.000000  7.833333

[2 rows x 34 columns]