{"id":16709082,"url":"https://github.com/thomasarsouze/regions_masks_generator","last_synced_at":"2026-04-14T17:32:17.053Z","repository":{"id":168590294,"uuid":"187626891","full_name":"thomasarsouze/Regions_masks_generator","owner":"thomasarsouze","description":"Easy handling of regions definition for model output","archived":false,"fork":false,"pushed_at":"2020-03-04T13:31:57.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-21T14:22:32.644Z","etag":null,"topics":["modeling","post-processing","regional-analyses"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasarsouze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-20T11:23:37.000Z","updated_at":"2020-03-04T13:31:59.000Z","dependencies_parsed_at":"2023-09-25T00:57:36.488Z","dependency_job_id":null,"html_url":"https://github.com/thomasarsouze/Regions_masks_generator","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":"0.33333333333333337","last_synced_commit":"fec37ea131af6f365d4f2dbbad921ee42136e814"},"previous_names":["thomasarsouze/regions_masks_generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasarsouze%2FRegions_masks_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasarsouze%2FRegions_masks_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasarsouze%2FRegions_masks_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasarsouze%2FRegions_masks_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasarsouze","download_url":"https://codeload.github.com/thomasarsouze/Regions_masks_generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243652693,"owners_count":20325607,"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":["modeling","post-processing","regional-analyses"],"created_at":"2024-10-12T19:48:32.678Z","updated_at":"2025-12-29T17:46:34.113Z","avatar_url":"https://github.com/thomasarsouze.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is Regions_masks_generator ?\nThis tools aims at generating regions mask in netcdf format in a way that it can be ported to any configuration and / or any model, to allow for simple comparisons when dealing with regional studies from larger models.\n\nThe script run_create_regions.py provides a simple example of all the steps and functions. \n\n## What is the general philosophy ?\nThere are two options to define a region:\n- by hand: provide a region name and a list of [lon, lat] points that define a polygon\n- via a kmz file: these are file that can be easily edited via Google Maps or (better Google Earth). The kmz file has\n to include a list of Polygons that defines the area of the region requested.\nRegions defined are stored into a dictionary called \"regions_dict\" that can be modified and saved to netcdf and kmz format.\n\n## What do I need to run this ?\nPython 3 and the following librairies:\n- xarray : http://xarray.pydata.org/en/stable/index.html\n- regionmask : https://regionmask.readthedocs.io/en/stable/\n\n## How to start ?\n1) Add create_regions.py to a directory in your PYTHONPATH (or current directory)\n2) open a python console\n3) Import create_regions and define your configuration (cf. example in run_create_regions.py)\n4) Start define your regions\n5) Save your regions to kmz and / or netcdf files\n\n## How to create regions by hand ?\nCheck examples in run_create_regions.py\ncreate_region function takes 3 arguments :\n- name of the region\n- abbreviated name (in the netcdf file, mask will be named \"tmaskxxxx\" xxxx begin the abbreviated name\n- list of [lon,lat] points defining a closed polygon that will define the area of the region\n\n## How to create regions from kmz file ?\nUse the function create_regions_from_kmz('my_kmz_file.kmz')\n\n## How to create a kmz file with multiple polygons ?\nIn Google Earth:\n1) Right-click on \"My Places\" -\u003e Add -\u003e Folder\n2) Right-click on the new Folder -\u003e Add -\u003e Polygon\nRepeat 2) for every new region\n3) Right-click on the new Folder -\u003e Save Place As\n\n## How to modify a polygon in Google Earth ?\nRight-click on the Polygon -\u003e Properties -\u003e Right-click on points of the Polygon to suppress them / Left-click to add a new point\n\n## How do I know the regions already defined ?\nUse the function get_list_regions()\n\n## I've defined some regions, but I'm not totaly happy with one that I'd like to modify. What should I do ?\nThis can be done in 3 simple steps:\n1) store the Polygon of the region you want to modify using the function get_polygon\n2) do the modification on this Polygon\n3) update the region definition with the new polygon using update_region. This will also update the mask of the region.\n\n## Ok, my regions are well defined, how do I generate a netcdf file with all the regions ?\nUse the function create_nc('my_nc_file.nc')\n\n## And what about saving a proper kmz file with the polygons of all the regions defined ?\nUse the function create_kmz('my_kmz_file.kmz')\n\n## I have a nice kmz file that I already used to generate regions, and I want to use it to generate the same region masks for my brand new configuration. How should I do ?\nUse the function create_nc_from_kmz('my_kmz_file.kmz','my_nc_file.nc')\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasarsouze%2Fregions_masks_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasarsouze%2Fregions_masks_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasarsouze%2Fregions_masks_generator/lists"}