Skip to content

Commit dab0ad2

Browse files
committed
/deploy sit
1 parent f7ce852 commit dab0ad2

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

podaac/tig/tig.py

+11-16
Original file line numberDiff line numberDiff line change
@@ -578,29 +578,24 @@ def non_nan_neighbors(arr, x, y):
578578

579579
def are_all_lon_lat_invalid(self, lon, lat):
580580
"""
581-
Checks if all longitude and latitude values in a NetCDF file are invalid.
581+
Checks if all coordinate pairs contain at least one invalid value.
582582
583583
Parameters:
584-
file_path (str): Path to the NetCDF file.
585-
lon_var (str): Name of the longitude variable in the file.
586-
lat_var (str): Name of the latitude variable in the file.
587-
584+
lon (array-like): Array of longitude values.
585+
lat (array-like): Array of latitude values.
588586
Returns:
589-
bool: True if all longitude and latitude values are invalid, False otherwise.
587+
bool: True if all coordinate pairs have at least one invalid value,
588+
False if there exists at least one valid coordinate pair.
590589
"""
591590
try:
592591
# Define valid ranges
593-
valid_lon = (lon >= -180) & (lon <= 180)
594-
valid_lat = (lat >= -90) & (lat <= 90)
595-
596-
# Check if all values are invalid
597-
all_invalid_lon = (~valid_lon).all().item()
598-
all_invalid_lat = (~valid_lat).all().item()
599-
600-
return all_invalid_lon and all_invalid_lat
592+
valid_lon_mask = (lon >= -180) & (lon <= 180)
593+
valid_lat_mask = (lat >= -90) & (lat <= 90)
594+
# Check if any pair is completely valid
595+
valid_pairs = valid_lon_mask & valid_lat_mask
596+
return not valid_pairs.any()
601597
except Exception as e:
602-
self.logger.error(f"Error: {e}")
603-
raise e
598+
raise RuntimeError(f"Error checking longitude/latitude validity: {e}") from e
604599

605600
def process_variable(self,
606601
var,

0 commit comments

Comments
 (0)