How to add your own shape file

Instructions how to add a new shape file of a new region to xweights.

Here it is explained on the example of the IPCC Reference Regions: IPCC-WGI Reference Regions version 4:

xweights:

Same procedure now for xweight, fork github/xweights to your github account, pull and make a new branch.

Edit:

Erstelle in meinen repository test_data einen neuen branch. Füge im Verzeichnis shp deinen gezippten shape file hinzu und pushe das Ganze. Nun kannst du einen pull request stellen. Erstelle einen neuen branch in weights.

Editiere die Datei

xweights/_regions.py:

L.51: Add your new region to the list (e.g. ipcc):

self.regions = ["counties", "counties_merged", "states", "prudence", "ipcc"]

Add at the end __init__ -Funktion

self.ipcc=IPCC()

copy the class counties_merged and add it again with your new name e.g. ipcc and add the name of your zipped shape file:

class IPCC:
      def __init__(self):
      self.description = (
      "IPCC regions"
      )
      self.geodataframe = self._ipcc()
      self.selection = "name"

def _ipcc(self):
self.regions = ["counties", "counties_merged", "states", "prudence", "srex"]

Füge am Ende der

__init__-Funktion self.srex=SREX()

Kopiere die Klasse Counties_merged und füge sie als neue Klasse unter dem Namen SREX hinzu:

class SREX:
      def __init__(self):
      self.description = (
      "S-REX regions"
      )
      self.geodataframe = self._srex()
      self.selection = "name"

def _srex(self):
    url_base = (
    "https://github.com/ludwiglierhammer/test_data/raw/main/shp"  # noqa
    )
    url = os.path.join(
          url_base, "<name_deiner_zip_datei>",
          )
    shape_zip = _pooch_retrieve(
    url,
    known_hash="2ca82af334aee2afdcce4799d5cc1ce50ce7bd0710c9ec39e6378519df60ad7a",  # noqa
     )
<<<<<<< HEAD

return _get_geodataframe(shape_zip, name=”IPCCv4”)

You can replace the known_hash with the HASH of your zipped file. This will be displayed when you run the following:

xweights -which_regions

Den known_hash kannst du mit dem HASH deiner gezippten Datei ersetzen. Dieser wird dir angezeigt, wenn du folgendes ausführst:

xweights which_regions