Skip to content

Commit ca41b0e

Browse files
Release 2.12.1 (#893)
* bump to 2.12.1 * update numpy constraint * pin min version of xarray that supports NumPy 2.0. Co-authored-by: Tom Vo <[email protected]> * Apply suggestions from code review * Apply suggestions from code review * git add image_checker.py --------- Co-authored-by: Tom Vo <[email protected]>
1 parent 3f5b036 commit ca41b0e

File tree

7 files changed

+57
-9
lines changed

7 files changed

+57
-9
lines changed

auxiliary_tools/image_checker.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
from PIL import Image, ImageChops
3+
4+
def images_are_identical(img1_path, img2_path):
5+
# Open both images
6+
with Image.open(img1_path) as img1, Image.open(img2_path) as img2:
7+
# Check if dimensions are the same
8+
if img1.size != img2.size:
9+
return False
10+
11+
# Check if pixel values are the same
12+
diff = ImageChops.difference(img1, img2)
13+
return not diff.getbbox() # getbbox() returns None if images are identical
14+
15+
def compare_png_images(dir1, dir2):
16+
# List to hold mismatched files, if any
17+
mismatched_files = []
18+
19+
# Walk through both directories simultaneously
20+
for root, _, files in os.walk(dir1):
21+
for file in files:
22+
if file.endswith('.png'):
23+
# Full path for file in dir1
24+
path1 = os.path.join(root, file)
25+
26+
# Construct corresponding path for file in dir2
27+
relative_path = os.path.relpath(path1, dir1)
28+
path2 = os.path.join(dir2, relative_path)
29+
30+
# Check if the file exists in the second directory
31+
if not os.path.exists(path2):
32+
print(f"File missing in second directory: {relative_path}")
33+
mismatched_files.append(relative_path)
34+
continue
35+
36+
# Compare images
37+
if not images_are_identical(path1, path2):
38+
print(f"Images do not match: {relative_path}")
39+
mismatched_files.append(relative_path)
40+
41+
# Final output
42+
if not mismatched_files:
43+
print("All .png images are identical.")
44+
else:
45+
print("Some images do not match or are missing in the second directory.")
46+
47+
# Example usage
48+
compare_png_images('/global/cfs/cdirs/e3sm/www/chengzhu/complete_run_11112024/e3sm_diags_extended', '/global/cfs/cdirs/e3sm/www/chengzhu/tutorial2024/e3sm_diags_extended')

conda-env/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ dependencies:
2323
- matplotlib-base
2424
- netcdf4
2525
- output_viewer >=1.3.0
26-
- numpy >=1.23.0
26+
- numpy >=2.0.0,<3.0.0
2727
- shapely >=2.0.0,<3.0.0
28-
- xarray >=2023.02.0
28+
- xarray >=2024.03.0
2929
# Testing
3030
# ==================
3131
- scipy

conda-env/dev-nompi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ dependencies:
2626
- matplotlib-base
2727
- netcdf4
2828
- output_viewer >=1.3.0
29-
- numpy >=1.23.0
29+
- numpy >=2.0.0,<3.0.0
3030
- shapely >=2.0.0,<3.0.0
31-
- xarray >=2023.02.0
31+
- xarray >=2024.03.0
3232
# Testing
3333
# =======================
3434
- scipy

conda-env/dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ dependencies:
2121
- matplotlib-base
2222
- netcdf4
2323
- output_viewer >=1.3.0
24-
- numpy >=1.23.0
24+
- numpy >=2.0.0,<3.0.0
2525
- shapely >=2.0.0,<3.0.0
26-
- xarray >=2023.02.0
26+
- xarray >=2024.03.0
2727
# Testing
2828
# =======================
2929
- scipy

e3sm_diags/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# issue with dask when using ESMF with system compilers.
77
import shapely
88

9-
__version__ = "v2.12.0"
9+
__version__ = "v2.12.1"
1010
INSTALL_PATH = os.path.join(sys.prefix, "share/e3sm_diags/")
1111

1212
# Disable MPI in cdms2, which is not currently supported by E3SM-unified

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def get_all_files_in_dir(directory, pattern):
156156
"Programming Language :: Python :: 3.10",
157157
],
158158
name="e3sm_diags",
159-
version="2.12.0",
159+
version="2.12.1",
160160
author="Chengzhu (Jill) Zhang, Tom Vo, Ryan Forsyth, Chris Golaz and Zeshawn Shaheen",
161161
author_email="[email protected]",
162162
description="E3SM Diagnostics",

tbump.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
github_url = "https://github.com/E3SM-Project/e3sm_diags"
33

44
[version]
5-
current = "2.12.0"
5+
current = "2.12.1"
66

77
# Example of a semver regexp.
88
# Make sure this matches current_version before

0 commit comments

Comments
 (0)