{"id":16200009,"url":"https://github.com/chilipp/latlon-utils","last_synced_at":"2025-08-04T12:33:15.836Z","repository":{"id":44943776,"uuid":"173439908","full_name":"Chilipp/latlon-utils","owner":"Chilipp","description":"Retrieve WorldClim climate and other information for lat-lon grid cells","archived":false,"fork":false,"pushed_at":"2024-05-29T17:18:34.000Z","size":51,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-15T09:13:15.177Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chilipp.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-02T11:31:13.000Z","updated_at":"2024-04-01T03:19:27.000Z","dependencies_parsed_at":"2024-10-10T09:29:05.797Z","dependency_job_id":"ddb66dec-4542-44ef-82a3-892fb6b91a67","html_url":"https://github.com/Chilipp/latlon-utils","commit_stats":{"total_commits":34,"total_committers":5,"mean_commits":6.8,"dds":"0.32352941176470584","last_synced_commit":"1acecc10a94b0d53be056c355d981358912c9d66"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chilipp%2Flatlon-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chilipp%2Flatlon-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chilipp%2Flatlon-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chilipp%2Flatlon-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chilipp","download_url":"https://codeload.github.com/Chilipp/latlon-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971180,"owners_count":20376784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T09:29:02.759Z","updated_at":"2025-03-19T05:30:53.975Z","avatar_url":"https://github.com/Chilipp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Retrieve WorldClim climate and other information for lat-lon grid cells\n=======================================================================\n\n|travis| |codecov| |version| |github| |supported-versions| |supported-implementations|\n\nThis repository contains utility functions to retrieve information for given\nlatitudes and longitude.\n\nInstallation\n------------\nWe strongly recommend to use conda_ for the installation. First, install the\nnecessary dependencies, namely netCDF4_, shapely_ and pandas_::\n\n    conda install netcdf4 shapely pandas\n\nTo enable the download of the WorldClim data, you will also need rasterio_ and\nxarray_ (you can skip this if you already downloaded the data) via::\n\n    conda install rasterio xarray\n\nThen install ``latlon_utils`` via::\n\n    pip install latlon_utils\n\nor from the source directory via::\n\n    pip install .\n\nUsage\n-----\nSo far, the package has two functions: the `get_climate` and `get_country`\nfunction. Use these like\n\nGet the country for 50 degrees north and 10 degrees east::\n\n    \u003e\u003e\u003e from latlon_utils import get_country\n\n    \u003e\u003e\u003e get_country(50, 10)\n    'Germany'\n\nGet the climate for 50 degrees north and 10 degrees east::\n\n    \u003e\u003e\u003e from latlon_utils import get_climate\n\n    # limit the number of columns printed by pandas\n    \u003e\u003e\u003e import pandas; pandas.options.display.max_columns = 5\n\n    \u003e\u003e\u003e get_climate(50, 10)\n    tavg  jan     0.044739\n          feb     0.974976\n          mar     4.705505\n          apr     8.232239\n          mai    13.150024\n          jun    16.012268\n          jul    17.958984\n          aug    17.828735\n          sep    13.779480\n          oct     8.787476\n          nov     4.039001\n          dec     1.430237\n          djf     0.816650\n          mam     8.695923\n          jja    17.266663\n          son     8.868652\n          ann     8.911972\n    prec  jan    48.000000\n          feb    42.000000\n          mar    44.000000\n          apr    44.000000\n          mai    56.000000\n          jun    68.000000\n          jul    65.000000\n          aug    52.000000\n          sep    47.000000\n          oct    52.000000\n          nov    52.000000\n          dec    59.000000\n          djf    49.666667\n          mam    48.000000\n          jja    61.666667\n          son    50.333333\n          ann    52.416667\n    Name: (50, 10), dtype: float64\n\n\n    \u003e\u003e\u003e get_climate(50, 10)['tavg', 'djf']\n    0.816650390625\n\n    \u003e\u003e\u003e get_climate([10, 11], [50, 51])\n                tavg             ...       prec\n                 jan        feb  ...        son       ann\n    lat lon                        ...\n    10  50   21.810730  22.687988  ...  10.666667  6.833333\n    11  51   24.617249  24.678040  ...   7.666667  3.750000\n    \u003cBLANKLINE\u003e\n    [2 rows x 34 columns]\n\nData download\n-------------\nThis package is built upon freely available datasets but does not contain any\ndata. This data is downloaded on request (see the next section). In particular,\nthe `get_climate` method uses the data from [WorldClim2.1]_, the `get_country`\nfunction uses the `datasets/geo-countries`_ repository.\n\nDownload directory\n******************\nTo download and process the necessary datasets, run::\n\n    python -m latlon_utils.download\n\n(see ``python -m latlon_utils.download --help`` for available options).\n\nWe download the GeoTIFF files from WorldClim_ and transform them to netCDF\ndatasets. The default directory to store the data is in\n``$HOME/.local/share/latlon_utils``, where ``$HOME`` stands for the users home\ndirectory. If you want to use a different directory, set the ``LATLONDATA``\nvariable, e.g.::\n\n    export LATLONDATA=$HOME/my_data\n    python download.py $LATLONDATA\n\nThe ``LATLONDATA`` environment variable is necessary to ensure that the python\npackage finds the data later again.\n\nWorldClim resolutions\n*********************\nThe default resolution that we use is ``10m``. However, you can also specify\nother resolutions in the python functions or via the ``LATLONRES`` environment\nvariable. To use, for example the 5 minutes resolutions, simply run::\n\n    export LATLONRES='5m'\n\n\nReferences\n----------\n.. [WorldClim2.1] Fick, S.E. and R.J. Hijmans, 2017. Worldclim 2: New 1-km spatial resolution climate surfaces for global land areas. International Journal of Climatology. http://worldclim.org/\n\n.. _WorldClim: https://worldclim.org/\n.. _datasets/geo-countries: https://github.com/datasets/geo-countries\n.. _xarray: http://xarray.pydata.org/en/stable/\n.. _rasterio: https://rasterio.readthedocs.io/en/stable/\n.. _netCDF4: https://github.com/Unidata/netcdf4-python\n.. _pandas: https://pandas.pydata.org/\n.. _conda: https://conda.io/projects/conda/en/latest/\n.. _shapely: https://shapely.readthedocs.io/en/latest/\n\n\n.. |travis| image:: https://travis-ci.org/Chilipp/latlon-utils.svg?branch=master\n    :alt: Travis\n    :target: https://travis-ci.org/Chilipp/latlon-utils\n\n.. |codecov| image:: https://codecov.io/gh/Chilipp/latlon-utils/branch/master/graph/badge.svg\n    :alt: Coverage\n    :target: https://codecov.io/gh/Chilipp/latlon-utils\n\n.. |version| image:: https://img.shields.io/pypi/v/latlon-utils.svg?style=flat\n    :alt: PyPI Package latest release\n    :target: https://pypi.python.org/pypi/latlon-utils\n\n.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/latlon-utils.svg?style=flat\n    :alt: Supported versions\n    :target: https://pypi.python.org/pypi/latlon-utils\n\n.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/latlon-utils.svg?style=flat\n    :alt: Supported implementations\n    :target: https://pypi.python.org/pypi/latlon-utils\n\n.. |github| image:: https://img.shields.io/github/release/Chilipp/latlon-utils.svg\n    :target: https://github.com/Chilipp/latlon-utils/releases/latest\n    :alt: Latest github release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchilipp%2Flatlon-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchilipp%2Flatlon-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchilipp%2Flatlon-utils/lists"}