From 95331120012ae077cd3d15e16bc8f05d7a332945 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 8 Oct 2024 09:48:49 -0600 Subject: [PATCH 1/5] added docs to blending_fv3.py --- ush/blending_fv3.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ush/blending_fv3.py b/ush/blending_fv3.py index 374d6ea0f..646804a9a 100755 --- a/ush/blending_fv3.py +++ b/ush/blending_fv3.py @@ -1,9 +1,22 @@ +""" +This file handles blending of FV3 tiles??? + +""" import numpy as np from netCDF4 import Dataset import raymond import sys def check_file_nans(test_nc, vars_fg, vars_bg, name): + """ + Check file NANS? + + test_nc: Test netCDF file. + vars_fg: Vars? + vars_bg: Vars? + name: Name of file? + + """ nans = False for (var_fg, var_bg) in zip(vars_fg, vars_bg): i = vars_fg.index(var_fg) From b3695ac2a1b8db026af5f79aaad678ccc4869034 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 8 Oct 2024 09:53:58 -0600 Subject: [PATCH 2/5] added requirements --- docs/requirements.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 7be32f526..aca438407 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,5 @@ sphinxcontrib-bibtex sphinx_rtd_theme -docutils==0.16 \ No newline at end of file +docutils==0.16 +numpy +netCDF4 From 7d955100e0f9ee8844b220e9c124ea0d8a29e667 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 8 Oct 2024 09:56:13 -0600 Subject: [PATCH 3/5] added requirements --- docs/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index aca438407..bf92cc4e0 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,3 +3,4 @@ sphinx_rtd_theme docutils==0.16 numpy netCDF4 +raymond From dc315b58cd2f0a971e4e845571fd593b62a79ee4 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 8 Oct 2024 10:03:01 -0600 Subject: [PATCH 4/5] more docs --- ush/blending_fv3.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ush/blending_fv3.py b/ush/blending_fv3.py index 646804a9a..6c643ad4f 100755 --- a/ush/blending_fv3.py +++ b/ush/blending_fv3.py @@ -33,6 +33,11 @@ def check_file_nans(test_nc, vars_fg, vars_bg, name): return nans def err_check(err): + """ + Check for error. + + err: Error code. + """ if err > 0: print(f"An error ocurred in {sys.argv[0]}. Blending failed!!!") print(f"err={err}") From cd1e4f9c0c176f0dd93ee1beb4eff8737e13993b Mon Sep 17 00:00:00 2001 From: Ed Date: Thu, 10 Oct 2024 12:17:53 -0600 Subject: [PATCH 5/5] more docs --- ush/blending_fv3.py | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/ush/blending_fv3.py b/ush/blending_fv3.py index 6c643ad4f..41d9e56cf 100755 --- a/ush/blending_fv3.py +++ b/ush/blending_fv3.py @@ -1,5 +1,7 @@ -""" -This file handles blending of FV3 tiles??? +"""This script performs blending between regional and global weather +forecast model restarts using the Fortran module raymond. The Raymond +filter is a sixth-order tangent low-pass implicit filter and can be +controlled via the cutoff length scale (Lx). """ import numpy as np @@ -8,13 +10,31 @@ import sys def check_file_nans(test_nc, vars_fg, vars_bg, name): - """ - Check file NANS? - - test_nc: Test netCDF file. - vars_fg: Vars? - vars_bg: Vars? - name: Name of file? + """Check for NaN values in specified variables of a netCDF file. + + This function iterates over a list of variables and checks for NaN values in the provided + netCDF file. It prints the count of NaNs found for each variable and indicates whether + any NaNs were detected. + + Again, if there are any NaNs found, I wanted to catch that here + instead of later when the model is running. I don't think there is + any reason to expect NaNs. + + Parameters: + test_nc: Dataset + The test netCDF file containing the variables to be checked for NaN values. + vars_fg: list of str + A list of variable names from the regional model (foreground) to check. + vars_bg: list of str + A corresponding list of variable names from the global model (background) to check. + name: str + A string representing the context (e.g., 'glb' for global or 'reg' for regional) + to identify the source of the variables being checked. + + Returns: + bool + Returns True if any NaN values are found in the specified variables; + otherwise, returns False. """ nans = False