switch_model/tools/graph/main.py
def _load_maps(self):
        """
        Plots the WECC states as a background on the provided axes
        and returns a dataframe with a mapping of load zones to center points.
        """
        if self._wecc_states is None or self._center_points is None:
            try:
                import geopandas
            except ModuleNotFoundError:
                raise Exception(
                    "Could not find package 'geopandas'. If on Windows make sure you install it through conda.")

            import shapely
            self._shapely = shapely
            self._geopandas = geopandas

            # Read shape files
            try:
                wecc_lz = geopandas.read_file(self._tools.get_file_path("maps/wecc_102009.shp", from_inputs=True),
                                              crs="ESRI:102009")
                self._wecc_states = geopandas.read_file(
                    self._tools.get_file_path("maps/wecc_states_4326.shp", from_inputs=True))
            except FileNotFoundError:
                raise Exception("Can't create maps, shape files are missing. Try running switch get_inputs.")

            wecc_lz = wecc_lz.rename({"LOAD_AREA": "gen_load_zone"}, axis=1)

            # New dataframe with the centerpoint geometry
            self._center_points = geopandas.GeoDataFrame(
                wecc_lz[["gen_load_zone"]],
                geometry=wecc_lz["geometry"].centroid,
                crs="ESRI:102009",
            ).to_crs("EPSG:4326")

        return self._wecc_states, self._center_points

        Plots the WECC states as a background on the provided axes
        and returns a dataframe with a mapping of load zones to center points.
        
Plots the WECC states as a background on the provided axes
and returns a dataframe with a mapping of load zones to center points.
Plots the WECC states as a background on the provided axes and returns a dataframe with a mapping of load zones to center points .
def _load_maps(self):
        if self._wecc_states is None or self._center_points is None:
            try:
                import geopandas
            except ModuleNotFoundError:
                raise Exception(
                    "Could not find package 'geopandas'. If on Windows make sure you install it through conda.")
            import shapely
            self._shapely = shapely
            self._geopandas = geopandas
            try:
                wecc_lz = geopandas.read_file(self._tools.get_file_path("maps/wecc_102009.shp", from_inputs=True),
                                              crs="ESRI:102009")
                self._wecc_states = geopandas.read_file(
                    self._tools.get_file_path("maps/wecc_states_4326.shp", from_inputs=True))
            except FileNotFoundError:
                raise Exception("Can't create maps, shape files are missing. Try running switch get_inputs.")
            wecc_lz = wecc_lz.rename({"LOAD_AREA": "gen_load_zone"}, axis=1)
            self._center_points = geopandas.GeoDataFrame(
                wecc_lz[["gen_load_zone"]],
                geometry=wecc_lz["geometry"].centroid,
                crs="ESRI:102009",
            ).to_crs("EPSG:4326")
        return self._wecc_states, self._center_points
def _load_maps ( self ) : if self . _wecc_states is None or self . _center_points is None : try : import geopandas except ModuleNotFoundError : raise Exception ( "Could not find package 'geopandas'. If on Windows make sure you install it through conda." ) import shapely self . _shapely = shapely self . _geopandas = geopandas try : wecc_lz = geopandas . read_file ( self . _tools . get_file_path ( "maps/wecc_102009.shp" , from_inputs = True ) , crs = "ESRI:102009" ) self . _wecc_states = geopandas . read_file ( self . _tools . get_file_path ( "maps/wecc_states_4326.shp" , from_inputs = True ) ) except FileNotFoundError : raise Exception ( "Can't create maps, shape files are missing. Try running switch get_inputs." ) wecc_lz = wecc_lz . rename ( { "LOAD_AREA" : "gen_load_zone" } , axis = 1 ) self . _center_points = geopandas . GeoDataFrame ( wecc_lz [ [ "gen_load_zone" ] ] , geometry = wecc_lz [ "geometry" ] . centroid , crs = "ESRI:102009" , ) . to_crs ( "EPSG:4326" ) return self . _wecc_states , self . _center_points
Plots the WECC states as a background on the provided axes
and returns a dataframe with a mapping of load zones to center points.
Plots the WECC states as a background on the provided axes and returns a dataframe with a mapping of load zones to center points .
"""
        Plots the WECC states as a background on the provided axes
        and returns a dataframe with a mapping of load zones to center points.
        """ # Read shape files # New dataframe with the centerpoint geometry
self