From 55587d9bc1ec5a6d9df68b10051577a5ddcad81e Mon Sep 17 00:00:00 2001 From: thopri <thopri@noc.ac.uk> Date: Wed, 22 Apr 2020 08:15:21 +0100 Subject: [PATCH] added commandline spinner --- docs/source/intro.rst | 5 ++++- docs/source/troubleshooting.rst | 3 +++ inputs/namelist_cmems.bdy | 6 +++--- inputs/namelist_remote.bdy | 8 ++++---- pynemo/pynemo_exe.py | 9 +++++++-- pynemo/reader/ncml.py | 3 ++- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/source/intro.rst b/docs/source/intro.rst index 463a8df..3b6be27 100644 --- a/docs/source/intro.rst +++ b/docs/source/intro.rst @@ -18,4 +18,7 @@ algorithm. The idea behind this targetted method is that it provides a generic method of interpolation for any flavour of ocean model in order to set up a regional NEMO model configuration. At present (alpha release) the tools do not contain many options, but those that exist are accessed either through a NEMO style -namelist or a convient GUI. +namelist or a convient GUI. + +PyNEMO has been updated to include integration with CMEMS data repository and the ability to produce tidal boundaries +using TPXO or FES2014 as boundary input. diff --git a/docs/source/troubleshooting.rst b/docs/source/troubleshooting.rst index 769efdb..2347dfd 100644 --- a/docs/source/troubleshooting.rst +++ b/docs/source/troubleshooting.rst @@ -1,6 +1,9 @@ Troubleshooting =============== +**Always** check the PyNEMO log file. This is usually saved in the working directory of PyNEMO as nrct.log. It gives helpful information +which may help to diagnose issues. E.g. ValueErrors that are result of a THREDDS server being down and unable to provide data files. + 1. pyNEMO crashing in MacOSX (Yosemite)? * Downgrade the scipy package to 0.15 diff --git a/inputs/namelist_cmems.bdy b/inputs/namelist_cmems.bdy index 2883afb..20119d5 100644 --- a/inputs/namelist_cmems.bdy +++ b/inputs/namelist_cmems.bdy @@ -52,10 +52,10 @@ ! CMEMS Data Source Configuration !------------------------------------------------------------------------------ ln_use_cmems = .true. - ln_download_cmems = .true. + ln_download_cmems = .false. sn_cmems_dir = '/Users/thopri/Projects/PyNEMO/inputs/' ! where to download CMEMS input files (static and variable) - ln_download_static = .false. - ln_subset_static = .false. + ln_download_static = .true. + ln_subset_static = .true. nn_num_retry = 4 ! how many times to retry CMEMS download after non critical errors? !------------------------------------------------------------------------------ ! CMEMS MOTU Configuration (for Boundary Data) diff --git a/inputs/namelist_remote.bdy b/inputs/namelist_remote.bdy index fb8d6bf..81bb8c4 100644 --- a/inputs/namelist_remote.bdy +++ b/inputs/namelist_remote.bdy @@ -68,7 +68,7 @@ ! unstructured open boundaries tidal parameters !------------------------------------------------------------------------------ ln_tide = .true. ! =T : produce bdy tidal conditions - sn_tide_model = 'fes' ! Name of tidal model (fes|tpxo) + sn_tide_model = 'tpxo' ! Name of tidal model (fes|tpxo) clname(1) = 'M2' ! constituent name clname(2) = 'S2' clname(3) = 'O1' @@ -86,9 +86,9 @@ sn_dst_calendar = 'gregorian' ! output calendar format nn_base_year = 1960 ! base year for time counter ! TPXO file locations - sn_tide_grid = '/Users/thopri/Projects/PyNEMO/DATA/TPXO/grid_tpxo7.2.nc' - sn_tide_h = '/Users/thopri/Projects/PyNEMO/DATA/TPXO/h_tpxo7.2.nc' - sn_tide_u = '/Users/thopri/Projects/PyNEMO/DATA/TPXO/u_tpxo7.2.nc' + sn_tide_grid = '/Users/thopri/Projects/PyNEMO/DATA/TPXO/grid_tpxo9.nc' + sn_tide_h = '/Users/thopri/Projects/PyNEMO/DATA/TPXO/h_tpxo9.v2a.nc' + sn_tide_u = '/Users/thopri/Projects/PyNEMO/DATA/TPXO/u_tpxo9.v2a.nc' ! location of FES data sn_tide_fes = '/Users/thopri/Projects/PyNEMO/DATA/FES/' diff --git a/pynemo/pynemo_exe.py b/pynemo/pynemo_exe.py index 1f8fb04..7069853 100644 --- a/pynemo/pynemo_exe.py +++ b/pynemo/pynemo_exe.py @@ -11,6 +11,9 @@ import logging # Logging set to info logging.basicConfig(level=logging.INFO) import time +from yaspin import yaspin +from yaspin.spinners import Spinners + def main(): """ Main function which checks the command line parameters and passes them to the profile module for processing """ @@ -37,7 +40,8 @@ def main(): elif opt in ("-d", "--download_cmems"): setup_file = arg t0 = time.time() - profile.download_cmems(setup_file) + with yaspin(Spinners.earth, text='PyNEMO is running'): + profile.download_cmems(setup_file) t1 = time.time() print("CMEMS download time: %s" % (t1 - t0)) sys.exit(0) @@ -49,7 +53,8 @@ def main(): #Logger #logger = logging.getLogger(__name__) t0 = time.time() - profile.process_bdy(setup_file, mask_gui) + with yaspin(Spinners.earth, text='PyNEMO is running'): + profile.process_bdy(setup_file, mask_gui) t1 = time.time() print("Execution Time: %s" % (t1-t0)) diff --git a/pynemo/reader/ncml.py b/pynemo/reader/ncml.py index 7275f05..67c0e4c 100644 --- a/pynemo/reader/ncml.py +++ b/pynemo/reader/ncml.py @@ -14,6 +14,7 @@ from cftime import utime ncmlpath, file_name = os.path.split(__file__) ncmlpath = os.path.join(ncmlpath, "jars", "netcdfAll-4.6.jar") jnius_config.set_classpath('.',ncmlpath) +logger = logging.getLogger(__name__) try: if os.environ['http_proxy'] is not None: #split the proxy name and port @@ -22,7 +23,7 @@ try: proxy_port = proxylist[1] jnius_config.add_options('-Dhttp.proxyHost='+proxy_host,'-Dhttp.proxyPort='+proxy_port) except: - print("Didn't find a proxy environment variable") + logger.info("Didn't find a proxy environment variable") NetcdfDataset = None NcMLReader = None Section = None -- GitLab