-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
27 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,20 +3,15 @@ | |
# Allard de Wit ([email protected]) | ||
|
||
import os, sys | ||
|
||
__version__ = "2.1.0" | ||
# This will be set to 1 only for commandline mode. Not when importing | ||
# agera5tools in python. | ||
os.environ["CMD_MODE"] = "0" | ||
from pathlib import Path | ||
import logging | ||
import logging.config | ||
|
||
import yaml | ||
from dotmap import DotMap | ||
import click | ||
|
||
from . import util | ||
|
||
__version__ = "2.1.0" | ||
|
||
def setup_logging(config, has_filesystem): | ||
"""sets up the logging system for both logging to file and to console. | ||
|
@@ -96,6 +91,7 @@ def setup_logging(config, has_filesystem): | |
else: | ||
logging.config.dictConfig(LOG_CONFIG_RTD) | ||
|
||
|
||
def read_config(mk_paths=True): | ||
"""Reads the YAML file with configuration for AgERA5tools | ||
|
@@ -107,6 +103,9 @@ def read_config(mk_paths=True): | |
:return:a DotMap object with the configuration | ||
""" | ||
from .util import BoundingBox | ||
import yaml | ||
from dotmap import DotMap | ||
import click | ||
|
||
has_config = False | ||
if "AGERA5TOOLS_CONFIG" in os.environ: | ||
|
@@ -143,19 +142,20 @@ def read_config(mk_paths=True): | |
|
||
return c | ||
|
||
|
||
has_filesystem = False if "READTHEDOCS" in os.environ else True | ||
config = read_config(mk_paths=has_filesystem) | ||
if config: | ||
setup_logging(config, has_filesystem) | ||
|
||
from . import util | ||
from .dump_grid import dump_grid | ||
from .dump_clip import dump, clip | ||
from .extract_point import extract_point | ||
from . import build | ||
from . import init | ||
from . import check | ||
from . import mirror | ||
if "READTHEDOCS" not in os.environ: | ||
from . import util | ||
from .dump_grid import dump_grid | ||
from .dump_clip import dump, clip | ||
from .extract_point import extract_point | ||
from . import build | ||
from . import init | ||
from . import check | ||
from . import mirror | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,5 +146,6 @@ def mirror(to_csv=True, dry_run=False): | |
|
||
return days, days_failed | ||
|
||
|
||
if __name__ == "__main__": | ||
mirror() | ||
mirror() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters