Skip to content
Snippets Groups Projects
Commit e265fe26 authored by tomrink's avatar tomrink
Browse files

new scan method

parent e6de145a
No related branches found
No related tags found
No related merge requests found
......@@ -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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment