diff --git a/modules/util/viirs_l1b_l2.py b/modules/util/viirs_l1b_l2.py index e1051f3129b88b7f612aea0d795e9d08e1e26206..e865b3efc9a410389955b66bebed25a38ffc45ec 100644 --- a/modules/util/viirs_l1b_l2.py +++ b/modules/util/viirs_l1b_l2.py @@ -238,6 +238,23 @@ def scan(directory): h5f.close() +def scan_for_location(txt_file, lon_range=[111.0, 130.0], lat_range=[14.0, 32.0]): + with open(txt_file) as file: + for idx, fpath in enumerate(file): + h5f = h5py.File(fpath, 'r') + try: + lon_s = get_grid_values_all(h5f, 'longitude') + lat_s = get_grid_values_all(h5f, 'latitude') + c_lon, c_lat = lon_s[1624, 1600], lat_s[1624, 1600] + if (lon_range[0] < c_lon < lon_range[1]) and (lat_range[0] < c_lat < lat_range[1]): + print(fpath) + + except Exception as e: + # print(e) + h5f.close() + continue + + def test_nlcomp(file): h5f = h5py.File(file, 'r')