From 29b5a7cefc937b3aacba6ec0d42a998a9f4e67ef Mon Sep 17 00:00:00 2001 From: Quentin Rodier <quentin.rodier@meteo.fr> Date: Fri, 15 Apr 2022 18:06:20 +0200 Subject: [PATCH] Quentin 15/04/2022: compare mesonh backup files not in HALO point (only physical) --- compare.py | 23 ++++++++++++++++++----- correct_indent.py | 1 - 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/compare.py b/compare.py index e2f86dbe8..b368f4791 100755 --- a/compare.py +++ b/compare.py @@ -8,15 +8,28 @@ def compareFiles(path_user, path_ref): filen = '16JAN.1.12B18.001.nc' da = xr.open_dataset(path_user + '/' + filen) da2 = xr.open_dataset(path_ref + '/' + filen) + JPHEXT=1 + JPVEXT=1 + ni=len(da['ni']) + nj=len(da['nj']) + nk=len(da['level']) variables = list(da.keys()) for var in variables: try: - ecart_min = float(da2[var].min())-float(da[var].min()) - ecart_moy = float(da2[var].mean())-float(da[var].mean()) - ecart_max = float(da2[var].max())-float(da[var].max()) + if da[var].ndim == 4: #Variables time, level, nj, ni + ecart_min=float(da2[var][0,JPVEXT:nk-1-JPVEXT,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].min())-float(da[var][0,JPVEXT:nk-1-JPVEXT,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].min()) + ecart_moy=float(da2[var][0,JPVEXT:nk-1-JPVEXT,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].mean())-float(da[var][0,JPVEXT:nk-1-JPVEXT,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].mean()) + ecart_max=float(da2[var][0,JPVEXT:nk-1-JPVEXT,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].max())-float(da[var][0,JPVEXT:nk-1-JPVEXT,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].max()) + elif da[var].ndim == 3: #Variables time, nj, ni + ecart_min=float(da2[var][0,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].min())-float(da[var][0,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].min()) + ecart_moy=float(da2[var][0,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].mean())-float(da[var][0,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].mean()) + ecart_max=float(da2[var][0,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].max())-float(da[var][0,JPHEXT:nj-1-JPHEXT,JPHEXT:ni-1-JPHEXT].max()) + else: + ecart_min=float(da2[var].min())-float(da[var].min()) + ecart_moy=float(da2[var].mean())-float(da[var].mean()) + ecart_max=float(da2[var].max())-float(da[var].max()) if (ecart_min !=0 or ecart_moy !=0 or ecart_max !=0): - status += 1 - print(var, ecart_min, ecart_moy, ecart_max) + print(var,ecart_min,ecart_moy,ecart_max) except: pass diff --git a/correct_indent.py b/correct_indent.py index ef8e5adbb..f3f560585 100755 --- a/correct_indent.py +++ b/correct_indent.py @@ -109,7 +109,6 @@ def correct_indent(f): textwrite = check_indent(ncurrline, indent_score, i) # #ifdef handling = pass to next lines with no indent elif "#if" in i7: # ifdef or ifndef - print(i) textwrite = i passNextLine['Pass'], passNextLine['Reason'] = (True, "#ifdef") elif "#else" in i7: -- GitLab