Skip to content

Commit

Permalink
Release 2.12.1 (#893)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
chengzhuzhang and tomvothecoder authored Nov 21, 2024
1 parent 3f5b036 commit ca41b0e
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 9 deletions.
48 changes: 48 additions & 0 deletions auxiliary_tools/image_checker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import os
from PIL import Image, ImageChops

def images_are_identical(img1_path, img2_path):
# Open both images
with Image.open(img1_path) as img1, Image.open(img2_path) as img2:
# Check if dimensions are the same
if img1.size != img2.size:
return False

# Check if pixel values are the same
diff = ImageChops.difference(img1, img2)
return not diff.getbbox() # getbbox() returns None if images are identical

def compare_png_images(dir1, dir2):
# List to hold mismatched files, if any
mismatched_files = []

# Walk through both directories simultaneously
for root, _, files in os.walk(dir1):
for file in files:
if file.endswith('.png'):
# Full path for file in dir1
path1 = os.path.join(root, file)

# Construct corresponding path for file in dir2
relative_path = os.path.relpath(path1, dir1)
path2 = os.path.join(dir2, relative_path)

# Check if the file exists in the second directory
if not os.path.exists(path2):
print(f"File missing in second directory: {relative_path}")
mismatched_files.append(relative_path)
continue

# Compare images
if not images_are_identical(path1, path2):
print(f"Images do not match: {relative_path}")
mismatched_files.append(relative_path)

# Final output
if not mismatched_files:
print("All .png images are identical.")
else:
print("Some images do not match or are missing in the second directory.")

# Example usage
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')
4 changes: 2 additions & 2 deletions conda-env/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ dependencies:
- matplotlib-base
- netcdf4
- output_viewer >=1.3.0
- numpy >=1.23.0
- numpy >=2.0.0,<3.0.0
- shapely >=2.0.0,<3.0.0
- xarray >=2023.02.0
- xarray >=2024.03.0
# Testing
# ==================
- scipy
Expand Down
4 changes: 2 additions & 2 deletions conda-env/dev-nompi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ dependencies:
- matplotlib-base
- netcdf4
- output_viewer >=1.3.0
- numpy >=1.23.0
- numpy >=2.0.0,<3.0.0
- shapely >=2.0.0,<3.0.0
- xarray >=2023.02.0
- xarray >=2024.03.0
# Testing
# =======================
- scipy
Expand Down
4 changes: 2 additions & 2 deletions conda-env/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ dependencies:
- matplotlib-base
- netcdf4
- output_viewer >=1.3.0
- numpy >=1.23.0
- numpy >=2.0.0,<3.0.0
- shapely >=2.0.0,<3.0.0
- xarray >=2023.02.0
- xarray >=2024.03.0
# Testing
# =======================
- scipy
Expand Down
2 changes: 1 addition & 1 deletion e3sm_diags/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# issue with dask when using ESMF with system compilers.
import shapely

__version__ = "v2.12.0"
__version__ = "v2.12.1"
INSTALL_PATH = os.path.join(sys.prefix, "share/e3sm_diags/")

# Disable MPI in cdms2, which is not currently supported by E3SM-unified
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def get_all_files_in_dir(directory, pattern):
"Programming Language :: Python :: 3.10",
],
name="e3sm_diags",
version="2.12.0",
version="2.12.1",
author="Chengzhu (Jill) Zhang, Tom Vo, Ryan Forsyth, Chris Golaz and Zeshawn Shaheen",
author_email="[email protected]",
description="E3SM Diagnostics",
Expand Down
2 changes: 1 addition & 1 deletion tbump.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
github_url = "https://github.com/E3SM-Project/e3sm_diags"

[version]
current = "2.12.0"
current = "2.12.1"

# Example of a semver regexp.
# Make sure this matches current_version before
Expand Down

0 comments on commit ca41b0e

Please sign in to comment.