Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguish list from tool version; bump to v1.3.0 #209

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fedelemflowlist/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
stream=sys.stdout)

flow_list_specs = {
"list_version": "1.2.4",
"tool_version": "1.3.0",
"list_version": "1.3.0",
"flow_classes": ["Biological", "Chemicals", "Energy", "Geological",
"Groups", "Land", "Other", "Water"],
"primary_context_classes": ["Directionality", "Environmental Media"],
Expand Down
17 changes: 10 additions & 7 deletions fedelemflowlist/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,14 @@ def write_to(self, path: Path, zw: zipio.ZipWriter = None):
def _write_flows(self, zw: zipio.ZipWriter):
altflowlist=fedelemflowlist.get_alt_conversion()
for _, row in self.flow_list.iterrows():
description = "From FedElemFlowList_"+flow_list_specs['list_version']+'.'
description = (
f"From Federal Elementary Flow List "
f"v{flow_list_specs['list_version']}, written by "
f"fedelemflowlist v{flow_list_specs['tool_version']}."
)
flow_class = row.get("Class")
if flow_class is not None:
description += " Flow Class: %s." % flow_class
description += f" Flow Class: {flow_class}."

preferred = row.get("Preferred", 0)
if preferred == 1 or preferred == "1":
Expand All @@ -182,8 +186,7 @@ def _write_flows(self, zw: zipio.ZipWriter):
fp.conversion_factor = 1.0
fp.flow_property = units.property_ref(row["Unit"])
if fp.flow_property is None:
log.warning("unknown unit %s in flow %s",
row["Unit"], row["Flow UUID"])
log.warning(f"unknown unit {row['Unit']} in flow {row['Flow UUID']}")
flow.flow_properties = [fp]
#Add in alternate unit flow propert(ies), if an alternate unit exists
#in the flows list, uses short list of altflowlist to assign one or more
Expand All @@ -197,8 +200,8 @@ def _write_flows(self, zw: zipio.ZipWriter):
altfp.conversion_factor = alternate['AltUnitConversionFactor']
altfp.flow_property = units.property_ref(alternate["AltUnit"])
if altfp.flow_property is None:
log.warning("unknown altunit %s in flow %s",
alternate["AltUnit"], row["Flow UUID"])
log.warning(f"unknown altunit {alternate['AltUnit']} "
f"in flow {row['Flow UUID']}")
else:
flow.flow_properties.append(altfp)
zw.write(flow)
Expand Down Expand Up @@ -231,5 +234,5 @@ def _write_mappings(self, zw: zipio.ZipWriter):
# as there are currenty only methods for writing RootEntity
# objects in the ZipWriter
zw._ZipWriter__zip.writestr(
"flow_mappings/" + flow_map["@id"] + ".json",
f"flow_mappings/{flow_map['@id']}.json",
json.dumps(flow_map))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='fedelemflowlist',
version='1.2.4',
version='1.3.0',
packages=['fedelemflowlist'],
package_dir={'fedelemflowlist': 'fedelemflowlist'},
package_data={'fedelemflowlist': [
Expand Down
Loading