scripts/* revise imports
This commit is contained in:
parent
bb9bbf295a
commit
e59d2c4162
@ -88,24 +88,21 @@ It further adds extendable ``generators`` and ``storage_units`` with **zero** ca
|
||||
- additional open- and combined-cycle gas turbines (if ``OCGT`` and/or ``CCGT`` is listed in the config setting ``electricity: extendable_carriers``)
|
||||
"""
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
import pandas as pd
|
||||
idx = pd.IndexSlice
|
||||
|
||||
import numpy as np
|
||||
import xarray as xr
|
||||
|
||||
import geopandas as gpd
|
||||
|
||||
from vresutils.costdata import annuity
|
||||
from vresutils.load import timeseries_opsd
|
||||
from vresutils import transfer as vtransfer
|
||||
|
||||
import logging
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import xarray as xr
|
||||
import geopandas as gpd
|
||||
import pypsa
|
||||
import powerplantmatching as ppm
|
||||
|
||||
idx = pd.IndexSlice
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def normed(s): return s/s.sum()
|
||||
|
||||
|
@ -36,14 +36,13 @@ Description
|
||||
-----------
|
||||
|
||||
"""
|
||||
from vresutils.graph import voronoi_partition_pts
|
||||
|
||||
import os
|
||||
from operator import attrgetter
|
||||
|
||||
import pandas as pd
|
||||
import geopandas as gpd
|
||||
|
||||
from vresutils.graph import voronoi_partition_pts
|
||||
|
||||
import pypsa
|
||||
import logging
|
||||
|
@ -64,7 +64,6 @@ import xarray as xr
|
||||
import pandas as pd
|
||||
|
||||
import geokit as gk
|
||||
from osgeo import gdal
|
||||
from scipy.sparse import vstack
|
||||
import pycountry as pyc
|
||||
import matplotlib.pyplot as plt
|
||||
|
@ -56,7 +56,6 @@ Description
|
||||
|
||||
import os
|
||||
import atlite
|
||||
import pandas as pd
|
||||
import geopandas as gpd
|
||||
from vresutils import hydro as vhydro
|
||||
import logging
|
||||
|
@ -37,7 +37,6 @@ Description
|
||||
|
||||
import numpy as np
|
||||
import atlite
|
||||
from osgeo import gdal
|
||||
import geokit as gk
|
||||
|
||||
def determine_cutout_xXyY(cutout_name):
|
||||
|
@ -51,7 +51,6 @@ Replacing '/summaries/' with '/plots/' creates nice colored maps of the results.
|
||||
|
||||
import os
|
||||
from six import iteritems
|
||||
from itertools import product
|
||||
import pandas as pd
|
||||
|
||||
import pypsa
|
||||
|
@ -15,20 +15,11 @@ Description
|
||||
|
||||
"""
|
||||
|
||||
import pypsa
|
||||
|
||||
from _helpers import load_network, aggregate_p, aggregate_costs
|
||||
from vresutils import plot as vplot
|
||||
|
||||
import os
|
||||
import pypsa
|
||||
import pandas as pd
|
||||
import geopandas as gpd
|
||||
import numpy as np
|
||||
from itertools import product, chain
|
||||
from six.moves import map, zip
|
||||
from six import itervalues, iterkeys
|
||||
from collections import OrderedDict as odict
|
||||
from six.moves import zip
|
||||
import logging
|
||||
|
||||
import cartopy.crs as ccrs
|
||||
@ -36,7 +27,6 @@ import matplotlib.pyplot as plt
|
||||
import matplotlib as mpl
|
||||
from matplotlib.patches import Circle, Ellipse
|
||||
from matplotlib.legend_handler import HandlerPatch
|
||||
import seaborn as sns
|
||||
to_rgba = mpl.colors.colorConverter.to_rgba
|
||||
|
||||
def make_handler_map_to_scale_circles_as_in(ax, dont_resize_actively=False):
|
||||
@ -92,7 +82,7 @@ def plot_map(n, ax=None, attribute='p_nom', opts={}):
|
||||
line_widths_exp = dict(Line=n.lines.s_nom_opt, Link=n.links.p_nom_opt)
|
||||
line_widths_cur = dict(Line=n.lines.s_nom_min, Link=n.links.p_nom_min)
|
||||
else:
|
||||
raise 'plotting of {} has not been implemented yet'.format(plot)
|
||||
raise 'plotting of {} has not been implemented yet'.format(attribute)
|
||||
|
||||
|
||||
line_colors_with_alpha = \
|
||||
@ -140,11 +130,11 @@ def plot_map(n, ax=None, attribute='p_nom', opts={}):
|
||||
handles.append(plt.Line2D([0],[0],color=line_colors['exp'],
|
||||
linewidth=s*1e3/linewidth_factor))
|
||||
labels.append("{} GW".format(s))
|
||||
l1 = l1_1 = ax.legend(handles, labels,
|
||||
loc="upper left", bbox_to_anchor=(0.24, 1.01),
|
||||
frameon=False,
|
||||
labelspacing=0.8, handletextpad=1.5,
|
||||
title='Transmission Exist./Exp. ')
|
||||
l1_1 = ax.legend(handles, labels,
|
||||
loc="upper left", bbox_to_anchor=(0.24, 1.01),
|
||||
frameon=False,
|
||||
labelspacing=0.8, handletextpad=1.5,
|
||||
title='Transmission Exist./Exp. ')
|
||||
ax.add_artist(l1_1)
|
||||
|
||||
handles = []
|
||||
|
@ -32,7 +32,6 @@ Description
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
if __name__ == "__main__":
|
||||
links_p_nom = pd.read_html('https://en.wikipedia.org/wiki/List_of_HVDC_projects', header=0, match="SwePol")[0]
|
||||
|
@ -78,21 +78,14 @@ The rule :mod:`simplify_network` does up to four things:
|
||||
4. Optionally, if an integer were provided for the wildcard ``{simpl}`` (e.g. ``networks/elec_s500.nc``), the network is clustered to this number of clusters with the routines from the ``cluster_network`` rule with the function ``cluster_network.cluster(...)``. This step is usually skipped!
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
idx = pd.IndexSlice
|
||||
from cluster_network import clustering_for_n_clusters, cluster_regions
|
||||
from add_electricity import load_costs
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
import os
|
||||
import re
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import scipy as sp
|
||||
from scipy.sparse.csgraph import connected_components, dijkstra
|
||||
import xarray as xr
|
||||
import geopandas as gpd
|
||||
import shapely
|
||||
import networkx as nx
|
||||
|
||||
from six import iteritems
|
||||
from six.moves import reduce
|
||||
@ -101,8 +94,9 @@ import pypsa
|
||||
from pypsa.io import import_components_from_dataframe, import_series_from_dataframe
|
||||
from pypsa.networkclustering import busmap_by_stubs, aggregategenerators, aggregateoneport
|
||||
|
||||
from cluster_network import clustering_for_n_clusters, cluster_regions
|
||||
from add_electricity import load_costs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
idx = pd.IndexSlice
|
||||
|
||||
def simplify_network_to_380(n):
|
||||
## All goes to v_nom == 380
|
||||
|
@ -82,7 +82,6 @@ import pandas as pd
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
import gc
|
||||
import os
|
||||
|
||||
import pypsa
|
||||
from pypsa.descriptors import free_output_series_dataframes
|
||||
|
@ -40,20 +40,17 @@ Description
|
||||
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from solve_network import patch_pyomo_tmpdir, prepare_network, solve_network
|
||||
|
||||
import logging
|
||||
import pypsa
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Detect running outside of snakemake and mock snakemake for testing
|
||||
if 'snakemake' not in globals():
|
||||
from vresutils.snakemake import MockSnakemake, Dict
|
||||
from vresutils.snakemake import MockSnakemake
|
||||
snakemake = MockSnakemake(
|
||||
wildcards=dict(network='elec', simpl='', clusters='45', lv='1.25', opts='Co2L-3H'),
|
||||
input=["networks/{network}_s{simpl}_{clusters}_lv{lv}_{opts}.nc"],
|
||||
|
Loading…
Reference in New Issue
Block a user