-
Notifications
You must be signed in to change notification settings - Fork 14
[Tool] Best Guess Netcdfs diff #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
[Tool] Best Guess Netcdfs diff #177
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes, but also how many of these did you run into when diffing NetCDFs? Do you want to add checks for extra dimensions while we're at it
def get_parser(): | ||
parser = argparse.ArgumentParser( | ||
"Attempt to diff two NetCDFs with similar data." | ||
"Differences that can be reconcialed are strict domain vs halo, variable name mapping." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Differences that can be reconcialed are strict domain vs halo, variable name mapping." | |
"Differences that can be reconciled are strict domain vs halo, variable name mapping." |
parser = argparse.ArgumentParser( | ||
"Attempt to diff two NetCDFs with similar data." | ||
"Differences that can be reconcialed are strict domain vs halo, variable name mapping." | ||
"They program will report on assumptions taken." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"They program will report on assumptions taken." | |
"The program will report on assumptions taken." |
parser.add_argument( | ||
"netcdf_A", | ||
type=str, | ||
help="path of NetCDFs, named A in the logs.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help="path of NetCDFs, named A in the logs.", | |
help="path of first NetCDF file, named A in the logs.", |
parser.add_argument( | ||
"netcdf_B", | ||
type=str, | ||
help="path of NetCDFs, named B in the logs.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help="path of NetCDFs, named B in the logs.", | |
help="path of second NetCDF file, named B in the logs.", |
xr.Dataset(dataset).to_netcdf(f"best_guest_diff_{pathlib.Path(netcdf_A).stem}.nc4") | ||
|
||
|
||
def entry_point(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too good to call it main()
? 😂
Main change
This PR proposes a new tool to check NetCDFs against one another with a series of guess to match compute domains. The tool describe it's logic as it goes down and fail if it can't resolve.
Options for name mapping & halo size.
After (re)installing NDSL, it can be called with
where
name_mapping
is a yaml file with a single dictionary mapping name in A to B.Minor QOL
quantity.to_netcdf
when no rank is given looks at the rank itselfndsl_log
is imported early to avoid circular dependencies