mrio-toolbox 1.1.1__py3-none-any.whl → 1.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mrio-toolbox might be problematic. Click here for more details.
- {mrio_toolbox/_parts → _parts}/_Part.py +82 -41
- {mrio_toolbox/extractors → extractors}/exiobase/exiobase_extractor.py +1 -1
- {mrio_toolbox/extractors → extractors}/extractors.py +8 -6
- {mrio_toolbox-1.1.1.dist-info → mrio_toolbox-1.1.2.dist-info}/METADATA +2 -2
- mrio_toolbox-1.1.2.dist-info/RECORD +59 -0
- mrio_toolbox-1.1.2.dist-info/top_level.txt +6 -0
- {mrio_toolbox/utils → utils}/converters/pandas.py +1 -4
- {mrio_toolbox/utils → utils}/converters/xarray.py +4 -2
- {mrio_toolbox/utils → utils}/formatting/formatter.py +2 -3
- mrio_toolbox-1.1.1.dist-info/RECORD +0 -59
- mrio_toolbox-1.1.1.dist-info/top_level.txt +0 -1
- /mrio_toolbox/__init__.py → /__init__.py +0 -0
- {mrio_toolbox/_parts → _parts}/_Axe.py +0 -0
- {mrio_toolbox/_parts → _parts}/__init__.py +0 -0
- {mrio_toolbox/_parts → _parts}/part_operations.py +0 -0
- {mrio_toolbox/extractors → extractors}/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/downloaders.py +0 -0
- {mrio_toolbox/extractors → extractors}/emerging/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/emerging/emerging_extractor.py +0 -0
- {mrio_toolbox/extractors → extractors}/eora/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/eora/eora_extractor.py +0 -0
- {mrio_toolbox/extractors → extractors}/exiobase/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/figaro/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/figaro/figaro_downloader.py +0 -0
- {mrio_toolbox/extractors → extractors}/figaro/figaro_extractor.py +0 -0
- {mrio_toolbox/extractors → extractors}/gloria/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/gloria/gloria_extractor.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/extractor.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/harpy_files/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/harpy_files/_header_sets.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/harpy_files/har_file.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/harpy_files/har_file_io.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/harpy_files/header_array.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/extraction/harpy_files/sl4.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/gtap_mrio/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/gtap11/gtap_mrio/mrio_builder.py +0 -0
- {mrio_toolbox/extractors → extractors}/icio/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/icio/icio_extractor.py +0 -0
- {mrio_toolbox/extractors → extractors}/wiod/__init__.py +0 -0
- {mrio_toolbox/extractors → extractors}/wiod/wiod_extractor.py +0 -0
- /mrio_toolbox/mrio.py → /mrio.py +0 -0
- {mrio_toolbox-1.1.1.dist-info → mrio_toolbox-1.1.2.dist-info}/WHEEL +0 -0
- {mrio_toolbox-1.1.1.dist-info → mrio_toolbox-1.1.2.dist-info}/licenses/LICENSE +0 -0
- {mrio_toolbox/msm → msm}/__init__.py +0 -0
- {mrio_toolbox/msm → msm}/multi_scale_mapping.py +0 -0
- {mrio_toolbox/utils → utils}/__init__.py +0 -0
- {mrio_toolbox/utils → utils}/converters/__init__.py +0 -0
- {mrio_toolbox/utils → utils}/formatting/__init__.py +0 -0
- {mrio_toolbox/utils → utils}/loaders/__init__.py +0 -0
- {mrio_toolbox/utils → utils}/loaders/_loader.py +0 -0
- {mrio_toolbox/utils → utils}/loaders/_loader_factory.py +0 -0
- {mrio_toolbox/utils → utils}/loaders/_nc_loader.py +0 -0
- {mrio_toolbox/utils → utils}/loaders/_np_loader.py +0 -0
- {mrio_toolbox/utils → utils}/loaders/_pandas_loader.py +0 -0
- {mrio_toolbox/utils → utils}/loaders/_parameter_loader.py +0 -0
- {mrio_toolbox/utils → utils}/savers/__init__.py +0 -0
- {mrio_toolbox/utils → utils}/savers/_path_checker.py +0 -0
- {mrio_toolbox/utils → utils}/savers/_to_folder.py +0 -0
- {mrio_toolbox/utils → utils}/savers/_to_nc.py +0 -0
|
@@ -676,40 +676,44 @@ class Part:
|
|
|
676
676
|
dev.name = f"swapped_{self.name}"
|
|
677
677
|
return dev
|
|
678
678
|
|
|
679
|
-
def flatten(self
|
|
680
|
-
"""Flatten a
|
|
679
|
+
def flatten(self):
|
|
680
|
+
"""Flatten a multidimensional Part into a 1D Part
|
|
681
681
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
Whether to in the inverse level order.
|
|
682
|
+
Because Parts do not support repeated dimensions over the same axis,
|
|
683
|
+
Axis dimensions are disambiguated if needed by appending an index to the dimension name.
|
|
684
|
+
|
|
686
685
|
"""
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
686
|
+
def disambiguous_dimension(dim,existing,i=1):
|
|
687
|
+
while f"{dim}_{i}" in existing:
|
|
688
|
+
return disambiguous_dimension(dim,existing,i+1)
|
|
689
|
+
|
|
690
|
+
return f"{dim}_{i}"
|
|
691
|
+
|
|
692
|
+
enumerator = range(self.ndim)
|
|
693
|
+
order = "C"
|
|
694
|
+
labels = dict()
|
|
695
|
+
groupings = dict()
|
|
696
|
+
for ax in enumerator:
|
|
697
|
+
for dim in self.axes[ax].dimensions:
|
|
698
|
+
dim_name = dim
|
|
699
|
+
if dim in labels.keys():
|
|
700
|
+
dim_name = disambiguous_dimension(dim,labels)
|
|
701
|
+
log.info(f"Disambiguate dimension {dim} on axis {ax} into {dim_name}")
|
|
702
|
+
labels[dim_name] = self.axes[ax].labels[dim]
|
|
703
|
+
if dim in self.groupings.keys():
|
|
704
|
+
groupings[dim_name] = self.axes[ax].groupings[dim]
|
|
705
|
+
ax = Axe(labels,groupings)
|
|
704
706
|
return self.alias(data=self.data.flatten(order=order),
|
|
705
707
|
name=f"flattened_{self.name}",
|
|
706
708
|
axes =[ax])
|
|
707
709
|
|
|
708
710
|
|
|
709
|
-
def squeeze(self):
|
|
711
|
+
def squeeze(self,drop_ax=True,drop_dims=True):
|
|
710
712
|
axes = []
|
|
711
713
|
for ax in self.axes:
|
|
712
|
-
if
|
|
714
|
+
if drop_dims:
|
|
715
|
+
ax.squeeze()
|
|
716
|
+
if len(ax) > 1 or not drop_ax:
|
|
713
717
|
axes.append(ax)
|
|
714
718
|
return self.alias(data=np.squeeze(self.data),axes=axes,
|
|
715
719
|
name=f"squeezed_{self.name}")
|
|
@@ -908,13 +912,14 @@ class Part:
|
|
|
908
912
|
for axe in list(ax):
|
|
909
913
|
self.axes[axe].update_groupings(groupings)
|
|
910
914
|
|
|
911
|
-
def aggregate(self,on=
|
|
915
|
+
def aggregate(self,on=None,axis=None):
|
|
912
916
|
"""Aggregate dimensions along one or several axis.
|
|
913
917
|
|
|
914
918
|
If groupings are defined, these are taken into account.
|
|
915
919
|
If you want to sum over the dimension of an axis, use the sum method.
|
|
916
920
|
|
|
917
921
|
If no axis is specified, the operation is applied to all axes.
|
|
922
|
+
If no dimension is specified, the operation is applied to all possible dimensions.
|
|
918
923
|
|
|
919
924
|
Parameters
|
|
920
925
|
----------
|
|
@@ -939,6 +944,9 @@ class Part:
|
|
|
939
944
|
|
|
940
945
|
"""
|
|
941
946
|
log.debug(f"Aggregate Part {self.name} along axis {axis} on {on}")
|
|
947
|
+
|
|
948
|
+
if on is None:
|
|
949
|
+
on = list(self.groupings.keys())
|
|
942
950
|
|
|
943
951
|
|
|
944
952
|
if isinstance(on,list):
|
|
@@ -1283,23 +1291,36 @@ class Part:
|
|
|
1283
1291
|
"""
|
|
1284
1292
|
if axis is None:
|
|
1285
1293
|
axis = self.hasax(over)
|
|
1294
|
+
if isinstance(axis,int):
|
|
1295
|
+
axis = [axis]
|
|
1296
|
+
|
|
1297
|
+
output = self.copy()
|
|
1286
1298
|
|
|
1287
|
-
for ax in axis:
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1299
|
+
for ax in axis[::-1]:
|
|
1300
|
+
output = output._expand_on(ax,over)
|
|
1301
|
+
return output
|
|
1302
|
+
|
|
1303
|
+
def _expand_on(self,ax,over):
|
|
1304
|
+
"""Expand over a single axis"""
|
|
1305
|
+
ref_ax = self.axes[ax]
|
|
1306
|
+
new_ax = Axe({over: ref_ax.labels[over]}, groupings=self.groupings)
|
|
1307
|
+
axes = self.axes.copy()
|
|
1308
|
+
axes.insert(ax,new_ax)
|
|
1309
|
+
new_shape = list(self.shape)
|
|
1310
|
+
new_shape.insert(ax,len(new_ax))
|
|
1311
|
+
output = np.zeros(new_shape)
|
|
1312
|
+
selector = [slice(None)]*self.ndim
|
|
1313
|
+
ordering = ref_ax.dimensions.index(over)
|
|
1314
|
+
for item in ref_ax.labels[over]:
|
|
1315
|
+
newsel,refsel = selector.copy(),selector.copy()
|
|
1316
|
+
newsel.insert(ax,new_ax.get(item))
|
|
1317
|
+
ax_selector = ["all" for i in range(ordering)]
|
|
1318
|
+
ax_selector.append(item)
|
|
1319
|
+
newsel[ax+1] = ref_ax.get(ax_selector)
|
|
1320
|
+
refsel[ax]= ref_ax.get(ax_selector)
|
|
1321
|
+
output[tuple(newsel)] = self.data[tuple(refsel)]
|
|
1302
1322
|
return self.alias(data=output,name=f"expanded_{self.name}",axes=axes)
|
|
1323
|
+
|
|
1303
1324
|
|
|
1304
1325
|
def issquare(self):
|
|
1305
1326
|
"""Assert wether the Part is square"""
|
|
@@ -1620,6 +1641,26 @@ class Part:
|
|
|
1620
1641
|
def __neg__(self):
|
|
1621
1642
|
return self.alias(data=-self.data,name=f"-{self.name}")
|
|
1622
1643
|
|
|
1644
|
+
def __lt__(self,other):
|
|
1645
|
+
if isinstance(other,Part):
|
|
1646
|
+
return self.data < other.data
|
|
1647
|
+
return self.data < other
|
|
1648
|
+
|
|
1649
|
+
def __le__(self,other):
|
|
1650
|
+
if isinstance(other,Part):
|
|
1651
|
+
return self.data <= other.data
|
|
1652
|
+
return self.data <= other
|
|
1653
|
+
|
|
1654
|
+
def __gt__(self,other):
|
|
1655
|
+
if isinstance(other,Part):
|
|
1656
|
+
return self.data > other.data
|
|
1657
|
+
return self.data > other
|
|
1658
|
+
|
|
1659
|
+
def __ge__(self,other):
|
|
1660
|
+
if isinstance(other,Part):
|
|
1661
|
+
return self.data >= other.data
|
|
1662
|
+
return self.data >= other
|
|
1663
|
+
|
|
1623
1664
|
def __sub__(self,a):
|
|
1624
1665
|
if isinstance(a,Part):
|
|
1625
1666
|
name = a.name
|
|
@@ -51,7 +51,7 @@ def extract_exiobase3(
|
|
|
51
51
|
Dictionnary of countries and sectors labels.
|
|
52
52
|
|
|
53
53
|
"""
|
|
54
|
-
source = os.path.join(source, f"IOT_{year}_
|
|
54
|
+
source = os.path.join(source, f"IOT_{year}_{mode}")
|
|
55
55
|
#Check source path
|
|
56
56
|
if not os.path.exists(source):
|
|
57
57
|
log.error(f"{os.path.abspath(source)} does not exist.")
|
|
@@ -6,7 +6,7 @@ import logging as log
|
|
|
6
6
|
import os
|
|
7
7
|
log = log.getLogger(__name__)
|
|
8
8
|
|
|
9
|
-
def extract_MRIO(table,year,source,destination,
|
|
9
|
+
def extract_MRIO(table,year,source,destination=False,
|
|
10
10
|
preprocessing = False,
|
|
11
11
|
saving_kwargs = dict(),
|
|
12
12
|
extraction_kwargs = dict()):
|
|
@@ -68,12 +68,14 @@ def extract_MRIO(table,year,source,destination,
|
|
|
68
68
|
mrio = extract_emerging(year, source, **extraction_kwargs)
|
|
69
69
|
elif table == 'gtap11':
|
|
70
70
|
from mrio_toolbox.extractors.gtap11 import extract_gtap11
|
|
71
|
-
mrio = extract_gtap11(year, source,
|
|
71
|
+
mrio = extract_gtap11(year, source, **extraction_kwargs)
|
|
72
72
|
else:
|
|
73
73
|
raise ValueError(f"Unsupported MRIO table: {table}")
|
|
74
74
|
if preprocessing:
|
|
75
75
|
mrio.preprocess(**preprocessing)
|
|
76
|
-
if
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
if saving_kwargs or destination:
|
|
77
|
+
if destination:
|
|
78
|
+
mrio.save(destination, **saving_kwargs)
|
|
79
|
+
else:
|
|
80
|
+
mrio.save(destination)
|
|
81
|
+
return mrio
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mrio_toolbox
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Basic manipulation of Multi-Regional Input-Output tables.
|
|
5
5
|
Author-email: Timothe Beaufils <timothe.beaufils@pik-potsdam.de>, Florian Wirth <florian.wirth@pik-potsdam.de>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -29,4 +29,4 @@ Python package to handle Multi-Regional Input-Output tables in Python
|
|
|
29
29
|
|
|
30
30
|
mrio_toolbox is designed to manipulate MRIO table with a high level of flexibility
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
The documentation is available at https://tbeaufils.codeberg.page/.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
__init__.py,sha256=oFgfSYusvbP0OwzcEE3ItG-3OS2nGCu5Dh3ANPu99sM,907
|
|
2
|
+
mrio.py,sha256=ll1I-dKKncxo-GhnWhRmlLUezUxMr1dIUuKZbC7Kb3w,34936
|
|
3
|
+
_parts/_Axe.py,sha256=LhH1Vx085B6Jv-jDTT_ROP2-9GyyDVUD-L62jUhREMw,19888
|
|
4
|
+
_parts/_Part.py,sha256=TFRg_gmjR28sgqHsdDhMYhouDtZT9zviMRVW-UBAM3w,62366
|
|
5
|
+
_parts/__init__.py,sha256=dls6ESbnqzUiSpGRg9EkVN0XfUgDdpzRDb9Tvf9Znlk,127
|
|
6
|
+
_parts/part_operations.py,sha256=PpGnSpo2evMtXIHCMBHTaA7sXv6kZv8qaBpHzgetnq4,1622
|
|
7
|
+
extractors/__init__.py,sha256=uwp-VEHkkvKncdc15V9Hs0J6ABMFw6oLfnMeYh0NQGs,500
|
|
8
|
+
extractors/downloaders.py,sha256=_IdNkCzhizZZ5rvPpvM-TvQ2eny9PuGl7Q-mZPT0SKk,1361
|
|
9
|
+
extractors/extractors.py,sha256=VLYfONeXHIeo2pZPnTGjNCuMHc64ps20fRsuqAKsrgQ,3423
|
|
10
|
+
extractors/emerging/__init__.py,sha256=5L_OdZVy499lInfn1qNysR5gkQCsYtxHQ76nQgT6Wlk,53
|
|
11
|
+
extractors/emerging/emerging_extractor.py,sha256=8twv8bIN3LCvsjYwRzHks4YUrJSYlIP70Mi1I3WXYeg,3699
|
|
12
|
+
extractors/eora/__init__.py,sha256=hNEV1fd5VGu0euVyAVPc5FX3eDrK0P8sf0pCBJo05RY,50
|
|
13
|
+
extractors/eora/eora_extractor.py,sha256=-cFX0FhxYixu4COlhAc4Cia98UpwlRGMQRm2iKt8VQ4,4129
|
|
14
|
+
extractors/exiobase/__init__.py,sha256=Yy3X5PH5SEPvQhX71Oae8QL8nKvfTuaQVwVwUgXpf1g,55
|
|
15
|
+
extractors/exiobase/exiobase_extractor.py,sha256=XMLe-OLqeJ9PTwL63TV4flO6ZRHVSTm6f_a6cwU3dSo,13453
|
|
16
|
+
extractors/figaro/__init__.py,sha256=dKuW3WsJ_UcilFPDXczvfGnYgvCFuSc6p3mbYTEsHN4,78
|
|
17
|
+
extractors/figaro/figaro_downloader.py,sha256=q5NbNRYPDVnOuXpbD7q1blo-5rKBNEssAjijU263Mqw,13221
|
|
18
|
+
extractors/figaro/figaro_extractor.py,sha256=_MZtQU5g9taxFfux4b4cq3ZTtT_dda3otXNDrAUkgHo,7792
|
|
19
|
+
extractors/gloria/__init__.py,sha256=IQ_B4KYmKL1013YaFDnFl8JNez7nkF4Hv4oyT6shxyk,51
|
|
20
|
+
extractors/gloria/gloria_extractor.py,sha256=cr_nqy_rAZINhELQDhDooqa9D-3JGSS9LN1f0VkDQq0,6898
|
|
21
|
+
extractors/gtap11/__init__.py,sha256=Zk5yS2MyEzOdMvphFKifnqINQeAiPC3H4h-jIEWkYoM,247
|
|
22
|
+
extractors/gtap11/extraction/__init__.py,sha256=LbLoTaFAlXmgCATnjRdNUIwgpUTzphGJLxT53i72ur0,54
|
|
23
|
+
extractors/gtap11/extraction/extractor.py,sha256=v5DWVhfYkU7VjFfFJ94KON2ump5ceeX92WiDteJrSOM,4225
|
|
24
|
+
extractors/gtap11/extraction/harpy_files/__init__.py,sha256=brrMawTkLnuXroM6ms0WKersbnooKbyAFCqqUq2Cysg,245
|
|
25
|
+
extractors/gtap11/extraction/harpy_files/_header_sets.py,sha256=Ij4Qu_WDydFQnyWI_eabFFBBODKvqt0iQ-qw0A089b0,10612
|
|
26
|
+
extractors/gtap11/extraction/harpy_files/har_file.py,sha256=RZJGqucx1XBFcJNuekgCnpKw1wERur70WNMv8wPasDU,10765
|
|
27
|
+
extractors/gtap11/extraction/harpy_files/har_file_io.py,sha256=bqKT5PjxktJNOOaJkVPrmZpnm2W0dZGX3pRWcuI3UYU,36889
|
|
28
|
+
extractors/gtap11/extraction/harpy_files/header_array.py,sha256=wcSjSyJUxMo0u5tlQ3YvxZkHz3l11JIZhhFvq0HBTeU,10934
|
|
29
|
+
extractors/gtap11/extraction/harpy_files/sl4.py,sha256=16rtQHNIs8IiNL8iCXDYjGHbB6Ay8pKV0yjpMJLCIQo,10888
|
|
30
|
+
extractors/gtap11/gtap_mrio/__init__.py,sha256=ybiLYcBuR1_EOZoPuxAre0HGRO9YiHzyGpr7B8BAc5w,134
|
|
31
|
+
extractors/gtap11/gtap_mrio/mrio_builder.py,sha256=CnmbiGFcYsmkKJCzf0_ZdZ8nX2-prstxggtrCw9PNxU,5825
|
|
32
|
+
extractors/icio/__init__.py,sha256=emSLWDbQp4bsRY458fKITMHORbLjoRvrdxgek2WtK5o,50
|
|
33
|
+
extractors/icio/icio_extractor.py,sha256=t4nQlSLsMAtEJRcA1GHG67f-0TKd2LfUEO1vR2-SAV4,5013
|
|
34
|
+
extractors/wiod/__init__.py,sha256=JSJcx-3jMqhO7E0kcO7lpmbDqTv0wPfsDOw9R9PTPYA,50
|
|
35
|
+
extractors/wiod/wiod_extractor.py,sha256=FRTZ40BrRD6mK_ru2i6eFGSAFPFQ8s7S_Pir1gZyipo,4162
|
|
36
|
+
mrio_toolbox-1.1.2.dist-info/licenses/LICENSE,sha256=q7yPlSQr4UbocyAmi56sBygg841JSclXoeXH8eOG7xQ,35819
|
|
37
|
+
msm/__init__.py,sha256=YaLmvU6Vlxk-bSGv-HgWR-7rKa2mqTuDOwmBQdhkHi0,192
|
|
38
|
+
msm/multi_scale_mapping.py,sha256=Rshz9Q4DOFpaf17lYFMdLxkRayZGzkt73UkhXZ5kSjw,34510
|
|
39
|
+
utils/__init__.py,sha256=BdiUAsKXUfe-vEJSsyNOTwt1RWVCXQ_B1kAZ-EwPEmQ,108
|
|
40
|
+
utils/converters/__init__.py,sha256=HDYyq9Hu7ooi3nrS4yfrOzCcwZ--VkGhHlXEESLN5-A,163
|
|
41
|
+
utils/converters/pandas.py,sha256=KxhKdFT8kFFQ4RK_BKXl-Ei2GS9-qHim_Tfx_6iO_TM,7544
|
|
42
|
+
utils/converters/xarray.py,sha256=cUnZCyNI8bjaeLXfPYSKs8TEWWrC-3Dqj-9kefuxxYE,3758
|
|
43
|
+
utils/formatting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
+
utils/formatting/formatter.py,sha256=gjIvbTo2A3fhb8ryEDIIFCQ3X-C6Uo3Rw_wxMn_G0Eo,20795
|
|
45
|
+
utils/loaders/__init__.py,sha256=I0_rQReuL4Os4G0ZOhajUtMQB6fdTkjV2Bf1UDbSpL0,203
|
|
46
|
+
utils/loaders/_loader.py,sha256=tzV_yCkbPkfcsRgeUA0oyss_flU17HJ_lC4IC7duxj0,11210
|
|
47
|
+
utils/loaders/_loader_factory.py,sha256=L3L06IkaBcRekcFr-_iRabAOpuLqSSCF24EG-ge5l-w,3300
|
|
48
|
+
utils/loaders/_nc_loader.py,sha256=duqnnOV4-9tXY0TE6gk9fWR_gFrYGzp_dYB6uZ4PFmY,5263
|
|
49
|
+
utils/loaders/_np_loader.py,sha256=qrOXoiAkpWjuEJtAf3iJvk1qRP6DNFtK3m-whJjp09o,3784
|
|
50
|
+
utils/loaders/_pandas_loader.py,sha256=TO9OdGjaZYZheICZbWAx7-W6GE8VxK1ftMEyP3PG7n8,4065
|
|
51
|
+
utils/loaders/_parameter_loader.py,sha256=M8ZNKuuLY6cZF6pdlpM5fdFhK9NKrJ-DY9N_2mbCH6Y,13157
|
|
52
|
+
utils/savers/__init__.py,sha256=uiaTRDuqTYNsTAYME3NQgFzAqFjdg74S2nBvGR0ieZ4,313
|
|
53
|
+
utils/savers/_path_checker.py,sha256=f_oTP2xBybtNqK1wmHSv_9ZlXU7M89YopPBdFYeqvzk,916
|
|
54
|
+
utils/savers/_to_folder.py,sha256=jGQNmiofx47tCnwAa_s20Tmbn-XrCmv22SV7cYyGMbI,6155
|
|
55
|
+
utils/savers/_to_nc.py,sha256=I8AKwsB_0w_uwCI5pdD3HGf-ur96yAurJKzPyM8sv4w,1931
|
|
56
|
+
mrio_toolbox-1.1.2.dist-info/METADATA,sha256=DIrewkZvhomGZdxTmd7sV3Y7XsZxPgvZagDbnQR8nFM,1192
|
|
57
|
+
mrio_toolbox-1.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
58
|
+
mrio_toolbox-1.1.2.dist-info/top_level.txt,sha256=Tpjdt1QI4V6ieN2qlT-qH25rmBAN69EC5jCmbDYhOS0,42
|
|
59
|
+
mrio_toolbox-1.1.2.dist-info/RECORD,,
|
|
@@ -16,10 +16,7 @@ def to_pandas(part):
|
|
|
16
16
|
columns = part.axes[1].label(True))
|
|
17
17
|
if part.ndim==1:
|
|
18
18
|
return pd.DataFrame(part.data,index = part.axes[0].label(True))
|
|
19
|
-
|
|
20
|
-
return to_pandas(part.squeeze())
|
|
21
|
-
except:
|
|
22
|
-
raise ValueError(f"Cannot convert a Part with {part.ndim} dimensions to DataFrame.")
|
|
19
|
+
return to_pandas(part.flatten())
|
|
23
20
|
|
|
24
21
|
|
|
25
22
|
def make_part(df,name="from_df",
|
|
@@ -20,23 +20,25 @@ def to_DataArray(part):
|
|
|
20
20
|
developed = part.develop(squeeze=False) #Force non-squeeze to keep dimensions
|
|
21
21
|
old_dims = part.get_dimensions()
|
|
22
22
|
new_dims = developed.get_dimensions()
|
|
23
|
+
attrs = dict()
|
|
23
24
|
if old_dims != new_dims:
|
|
24
25
|
#We code the original dimensions in the metadata
|
|
25
26
|
#Because netcdf files do not support multi-level attributes
|
|
26
27
|
original_dims = [
|
|
27
28
|
dim for axe in old_dims for dim in axe+["_sep_"]
|
|
28
29
|
]
|
|
29
|
-
|
|
30
|
+
attrs["_original_dimensions"] = original_dims[:-1]
|
|
30
31
|
#The last bit removes the last separator
|
|
31
32
|
coords = list()
|
|
32
33
|
for axe in developed.axes:
|
|
33
34
|
coords.append(
|
|
34
35
|
axe.label(True)
|
|
35
36
|
)
|
|
37
|
+
attrs.update(part.metadata)
|
|
36
38
|
return xr.DataArray(
|
|
37
39
|
data = developed.data,
|
|
38
40
|
name = part.name,
|
|
39
|
-
attrs =
|
|
41
|
+
attrs = attrs,
|
|
40
42
|
coords = coords
|
|
41
43
|
)
|
|
42
44
|
|
|
@@ -374,9 +374,8 @@ def compute_leontief(mrio,
|
|
|
374
374
|
a = compute_technical_coefficients(mrio,
|
|
375
375
|
name=technical_coefficients_matrix,**kwargs)
|
|
376
376
|
else:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
**kwargs)
|
|
377
|
+
compute_technical_coefficients(mrio, name= technical_coefficients_matrix,
|
|
378
|
+
**kwargs)
|
|
380
379
|
a = mrio.parts[technical_coefficients_matrix]
|
|
381
380
|
mrio.parts[name] = a.leontief_inversion()
|
|
382
381
|
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
mrio_toolbox/__init__.py,sha256=oFgfSYusvbP0OwzcEE3ItG-3OS2nGCu5Dh3ANPu99sM,907
|
|
2
|
-
mrio_toolbox/mrio.py,sha256=ll1I-dKKncxo-GhnWhRmlLUezUxMr1dIUuKZbC7Kb3w,34936
|
|
3
|
-
mrio_toolbox/_parts/_Axe.py,sha256=LhH1Vx085B6Jv-jDTT_ROP2-9GyyDVUD-L62jUhREMw,19888
|
|
4
|
-
mrio_toolbox/_parts/_Part.py,sha256=iWCQdFitv4SmufTLFX4lbHqL1rKmwGklueVGbLsP7Bk,60899
|
|
5
|
-
mrio_toolbox/_parts/__init__.py,sha256=dls6ESbnqzUiSpGRg9EkVN0XfUgDdpzRDb9Tvf9Znlk,127
|
|
6
|
-
mrio_toolbox/_parts/part_operations.py,sha256=PpGnSpo2evMtXIHCMBHTaA7sXv6kZv8qaBpHzgetnq4,1622
|
|
7
|
-
mrio_toolbox/extractors/__init__.py,sha256=uwp-VEHkkvKncdc15V9Hs0J6ABMFw6oLfnMeYh0NQGs,500
|
|
8
|
-
mrio_toolbox/extractors/downloaders.py,sha256=_IdNkCzhizZZ5rvPpvM-TvQ2eny9PuGl7Q-mZPT0SKk,1361
|
|
9
|
-
mrio_toolbox/extractors/extractors.py,sha256=SqMptIFADlQehp8x0fv8PFYGNpID3c3sADX2eEvTx58,3431
|
|
10
|
-
mrio_toolbox/extractors/emerging/__init__.py,sha256=5L_OdZVy499lInfn1qNysR5gkQCsYtxHQ76nQgT6Wlk,53
|
|
11
|
-
mrio_toolbox/extractors/emerging/emerging_extractor.py,sha256=8twv8bIN3LCvsjYwRzHks4YUrJSYlIP70Mi1I3WXYeg,3699
|
|
12
|
-
mrio_toolbox/extractors/eora/__init__.py,sha256=hNEV1fd5VGu0euVyAVPc5FX3eDrK0P8sf0pCBJo05RY,50
|
|
13
|
-
mrio_toolbox/extractors/eora/eora_extractor.py,sha256=-cFX0FhxYixu4COlhAc4Cia98UpwlRGMQRm2iKt8VQ4,4129
|
|
14
|
-
mrio_toolbox/extractors/exiobase/__init__.py,sha256=Yy3X5PH5SEPvQhX71Oae8QL8nKvfTuaQVwVwUgXpf1g,55
|
|
15
|
-
mrio_toolbox/extractors/exiobase/exiobase_extractor.py,sha256=Zb9iiuW3VCxjKpHAofs5bPIYMGZ0DQwR44RW3fmaLOs,13455
|
|
16
|
-
mrio_toolbox/extractors/figaro/__init__.py,sha256=dKuW3WsJ_UcilFPDXczvfGnYgvCFuSc6p3mbYTEsHN4,78
|
|
17
|
-
mrio_toolbox/extractors/figaro/figaro_downloader.py,sha256=q5NbNRYPDVnOuXpbD7q1blo-5rKBNEssAjijU263Mqw,13221
|
|
18
|
-
mrio_toolbox/extractors/figaro/figaro_extractor.py,sha256=_MZtQU5g9taxFfux4b4cq3ZTtT_dda3otXNDrAUkgHo,7792
|
|
19
|
-
mrio_toolbox/extractors/gloria/__init__.py,sha256=IQ_B4KYmKL1013YaFDnFl8JNez7nkF4Hv4oyT6shxyk,51
|
|
20
|
-
mrio_toolbox/extractors/gloria/gloria_extractor.py,sha256=cr_nqy_rAZINhELQDhDooqa9D-3JGSS9LN1f0VkDQq0,6898
|
|
21
|
-
mrio_toolbox/extractors/gtap11/__init__.py,sha256=Zk5yS2MyEzOdMvphFKifnqINQeAiPC3H4h-jIEWkYoM,247
|
|
22
|
-
mrio_toolbox/extractors/gtap11/extraction/__init__.py,sha256=LbLoTaFAlXmgCATnjRdNUIwgpUTzphGJLxT53i72ur0,54
|
|
23
|
-
mrio_toolbox/extractors/gtap11/extraction/extractor.py,sha256=v5DWVhfYkU7VjFfFJ94KON2ump5ceeX92WiDteJrSOM,4225
|
|
24
|
-
mrio_toolbox/extractors/gtap11/extraction/harpy_files/__init__.py,sha256=brrMawTkLnuXroM6ms0WKersbnooKbyAFCqqUq2Cysg,245
|
|
25
|
-
mrio_toolbox/extractors/gtap11/extraction/harpy_files/_header_sets.py,sha256=Ij4Qu_WDydFQnyWI_eabFFBBODKvqt0iQ-qw0A089b0,10612
|
|
26
|
-
mrio_toolbox/extractors/gtap11/extraction/harpy_files/har_file.py,sha256=RZJGqucx1XBFcJNuekgCnpKw1wERur70WNMv8wPasDU,10765
|
|
27
|
-
mrio_toolbox/extractors/gtap11/extraction/harpy_files/har_file_io.py,sha256=bqKT5PjxktJNOOaJkVPrmZpnm2W0dZGX3pRWcuI3UYU,36889
|
|
28
|
-
mrio_toolbox/extractors/gtap11/extraction/harpy_files/header_array.py,sha256=wcSjSyJUxMo0u5tlQ3YvxZkHz3l11JIZhhFvq0HBTeU,10934
|
|
29
|
-
mrio_toolbox/extractors/gtap11/extraction/harpy_files/sl4.py,sha256=16rtQHNIs8IiNL8iCXDYjGHbB6Ay8pKV0yjpMJLCIQo,10888
|
|
30
|
-
mrio_toolbox/extractors/gtap11/gtap_mrio/__init__.py,sha256=ybiLYcBuR1_EOZoPuxAre0HGRO9YiHzyGpr7B8BAc5w,134
|
|
31
|
-
mrio_toolbox/extractors/gtap11/gtap_mrio/mrio_builder.py,sha256=CnmbiGFcYsmkKJCzf0_ZdZ8nX2-prstxggtrCw9PNxU,5825
|
|
32
|
-
mrio_toolbox/extractors/icio/__init__.py,sha256=emSLWDbQp4bsRY458fKITMHORbLjoRvrdxgek2WtK5o,50
|
|
33
|
-
mrio_toolbox/extractors/icio/icio_extractor.py,sha256=t4nQlSLsMAtEJRcA1GHG67f-0TKd2LfUEO1vR2-SAV4,5013
|
|
34
|
-
mrio_toolbox/extractors/wiod/__init__.py,sha256=JSJcx-3jMqhO7E0kcO7lpmbDqTv0wPfsDOw9R9PTPYA,50
|
|
35
|
-
mrio_toolbox/extractors/wiod/wiod_extractor.py,sha256=FRTZ40BrRD6mK_ru2i6eFGSAFPFQ8s7S_Pir1gZyipo,4162
|
|
36
|
-
mrio_toolbox/msm/__init__.py,sha256=YaLmvU6Vlxk-bSGv-HgWR-7rKa2mqTuDOwmBQdhkHi0,192
|
|
37
|
-
mrio_toolbox/msm/multi_scale_mapping.py,sha256=Rshz9Q4DOFpaf17lYFMdLxkRayZGzkt73UkhXZ5kSjw,34510
|
|
38
|
-
mrio_toolbox/utils/__init__.py,sha256=BdiUAsKXUfe-vEJSsyNOTwt1RWVCXQ_B1kAZ-EwPEmQ,108
|
|
39
|
-
mrio_toolbox/utils/converters/__init__.py,sha256=HDYyq9Hu7ooi3nrS4yfrOzCcwZ--VkGhHlXEESLN5-A,163
|
|
40
|
-
mrio_toolbox/utils/converters/pandas.py,sha256=aY3B-Rk-zBDL18-HnA6rpmItECJsrrT0c42f0CHLI-A,7665
|
|
41
|
-
mrio_toolbox/utils/converters/xarray.py,sha256=VqXH6KMLnp8pXHm3TYO1-w2hDv9_Ads5puW-PwctRMQ,3721
|
|
42
|
-
mrio_toolbox/utils/formatting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
|
-
mrio_toolbox/utils/formatting/formatter.py,sha256=yK2t8-MzEH1P9TMqZRj5ud26f1tZMqEkKpm8XgTblso,20870
|
|
44
|
-
mrio_toolbox/utils/loaders/__init__.py,sha256=I0_rQReuL4Os4G0ZOhajUtMQB6fdTkjV2Bf1UDbSpL0,203
|
|
45
|
-
mrio_toolbox/utils/loaders/_loader.py,sha256=tzV_yCkbPkfcsRgeUA0oyss_flU17HJ_lC4IC7duxj0,11210
|
|
46
|
-
mrio_toolbox/utils/loaders/_loader_factory.py,sha256=L3L06IkaBcRekcFr-_iRabAOpuLqSSCF24EG-ge5l-w,3300
|
|
47
|
-
mrio_toolbox/utils/loaders/_nc_loader.py,sha256=duqnnOV4-9tXY0TE6gk9fWR_gFrYGzp_dYB6uZ4PFmY,5263
|
|
48
|
-
mrio_toolbox/utils/loaders/_np_loader.py,sha256=qrOXoiAkpWjuEJtAf3iJvk1qRP6DNFtK3m-whJjp09o,3784
|
|
49
|
-
mrio_toolbox/utils/loaders/_pandas_loader.py,sha256=TO9OdGjaZYZheICZbWAx7-W6GE8VxK1ftMEyP3PG7n8,4065
|
|
50
|
-
mrio_toolbox/utils/loaders/_parameter_loader.py,sha256=M8ZNKuuLY6cZF6pdlpM5fdFhK9NKrJ-DY9N_2mbCH6Y,13157
|
|
51
|
-
mrio_toolbox/utils/savers/__init__.py,sha256=uiaTRDuqTYNsTAYME3NQgFzAqFjdg74S2nBvGR0ieZ4,313
|
|
52
|
-
mrio_toolbox/utils/savers/_path_checker.py,sha256=f_oTP2xBybtNqK1wmHSv_9ZlXU7M89YopPBdFYeqvzk,916
|
|
53
|
-
mrio_toolbox/utils/savers/_to_folder.py,sha256=jGQNmiofx47tCnwAa_s20Tmbn-XrCmv22SV7cYyGMbI,6155
|
|
54
|
-
mrio_toolbox/utils/savers/_to_nc.py,sha256=I8AKwsB_0w_uwCI5pdD3HGf-ur96yAurJKzPyM8sv4w,1931
|
|
55
|
-
mrio_toolbox-1.1.1.dist-info/licenses/LICENSE,sha256=q7yPlSQr4UbocyAmi56sBygg841JSclXoeXH8eOG7xQ,35819
|
|
56
|
-
mrio_toolbox-1.1.1.dist-info/METADATA,sha256=C6R8thAWD5oJTMF4H834cGx2nYPQ_oZ1avQIYI2C9_E,1193
|
|
57
|
-
mrio_toolbox-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
58
|
-
mrio_toolbox-1.1.1.dist-info/top_level.txt,sha256=Q2vYXHwBrGslGjwHwr_dnCyVOfx1gXwxd2G739rNwZg,13
|
|
59
|
-
mrio_toolbox-1.1.1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
mrio_toolbox
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/mrio_toolbox/mrio.py → /mrio.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|