Skip to content

Commit

Permalink
Fix Docs and update Changelog (#43)
Browse files Browse the repository at this point in the history
* Formatting applied

* Readthedocs update, separate env

* Update notebook

* Add sphinx to environment for now, until the issue there is solved

* Update docs

* Update docs

* Add docs requirements file

* Remove docs requirements again, fix error in ipynb

* Omit pdf build of docs, due to problems with special chars in ipnb

* Update changelog
  • Loading branch information
wpreimes authored Jul 13, 2021
1 parent 765291c commit c809f12
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 265 deletions.
3 changes: 0 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ version: 2
sphinx:
configuration: docs/conf.py

formats:
- pdf

submodules:
include: all

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ Unreleased

-

Version 1.1.0
=============

- Fixed bug in the metadata dataframe when not using all available networks.
- Citation export functions added to `Collection` and `Network` components.
- Citations for all networks are now stored in this package until they are reliably provided together with the data
- It is now possible to pass multiple allowed variables when filtering sensors.

Version 1.0.1
=============

Expand Down
2 changes: 1 addition & 1 deletion docs/_static/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Empty directory
# Empty directory
9 changes: 0 additions & 9 deletions docs/examples.rst

This file was deleted.

479 changes: 243 additions & 236 deletions docs/examples/interface.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../README.rst
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- configparser
- tqdm
- more_itertools
- sphinx==4.0.3 # there seems to be an issue with 4.1.0 and nbsphinx, when this is resolved this line can be deleted to use the latest version.
- nbsphinx
- sphinx_rtd_theme
- pytest
Expand Down
18 changes: 10 additions & 8 deletions src/ismn/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,11 @@ def get_citations(self):
try:
refs = CITATIONS[self.name]
except KeyError:
refs = [f'No reference(s) for network {self.name} available.']
refs = [f"No reference(s) for network {self.name} available."]

return refs


class NetworkCollection(IsmnComponent):
"""
A NetworkCollection holds multiple networks and provides functionality
Expand Down Expand Up @@ -793,17 +794,18 @@ def export_citations(self, out_file=None):
references: OrderedDict
Network names as keys and network references as values
"""
refs = OrderedDict([(net.name, net.get_citations())
for net in self.iter_networks()])
refs = OrderedDict(
[(net.name, net.get_citations()) for net in self.iter_networks()]
)

if out_file is not None:
with open(out_file, mode='w') as out_file:
with open(out_file, mode="w") as out_file:
for name, reflist in refs.items():
out_file.write(f'References for Network {name}:\n')
out_file.write(f"References for Network {name}:\n")
out_file.write("-----------------------------------------\n")
for ref in reflist:
out_file.write(f"{ref}\n")
out_file.write('\n')
out_file.write('\n')
out_file.write("\n")
out_file.write("\n")

return refs
return refs
15 changes: 10 additions & 5 deletions src/ismn/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ class DepthError(ValueError):
# Once the full list of citations is provided together with the downloaded
# ISMN data (in the README file), citations here can be deleted (keep in mind
# that people might still use old data, but a new version of the package).
CITATIONS: dict = \
pd.read_csv(os.path.join(os.path.dirname(__file__), 'citations.txt'),
index_col=0, delimiter=';') \
.groupby('Network')['Citation'].apply(list).to_dict()
CITATIONS: dict = (
pd.read_csv(
os.path.join(os.path.dirname(__file__), "citations.txt"),
index_col=0,
delimiter=";",
)
.groupby("Network")["Citation"]
.apply(list)
.to_dict()
)

# ==============================================================================
# Variable short names
Expand Down Expand Up @@ -239,4 +245,3 @@ class DepthError(ValueError):
]
)
# ==============================================================================

6 changes: 3 additions & 3 deletions src/ismn/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def activate_network(
self.__file_collection.to_metadata_csv(meta_csv_file)

self.__file_collection = IsmnFileCollection.from_metadata_csv(
self.root, meta_csv_file, network=network
)
self.root, meta_csv_file, network=network
)

metadata = self.__file_collection.metadata_df

Expand Down Expand Up @@ -893,4 +893,4 @@ def print_climate_dict(self) -> None:

def close_files(self):
# close all open filehandlers
self.__file_collection.close()
self.__file_collection.close()

0 comments on commit c809f12

Please sign in to comment.