Commit 23a1eb15 authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Test that the atmospheric domain is within the HydroFile domain.

parent b858c0a0
......@@ -20,6 +20,21 @@ INFO, DEBUG, ERROR =, log_master.debug, log_world.error
INFO_ALL, DEBUG_ALL =, log_world.debug
def getbox(ncdf, corners) :
# Check that the domain fits in the data available.
lonrange=[getattrcontaining(ncdf, "nav_lon", "min"), getattrcontaining(ncdf, "nav_lon", "max")]
latrange=[getattrcontaining(ncdf, "nav_lat", "min"), getattrcontaining(ncdf, "nav_lat", "max")]
if len(lonrange[0]) <= 0 :
if len(latrange[0]) <= 0 :
if np.min(corners[0][:]) < np.min(lonrange) or \
np.max(corners[0][:]) > np.max(lonrange) or \
np.min(corners[1][:]) < np.min(latrange) or \
np.max(corners[1][:]) > np.max(latrange) :
print("The atmospheric domain does not fit inside the area covered by HydroFile. Please check the file.")
# Add a few points to tbe box to make sure to cover everything
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment