Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_file_coords(files):
"""
Get list of Point objects
"""
points = Plist()
for i, filename in enumerate(files):
# fname = path.split(f)[1][-16:] # just look at last 16 characters
f = filename[-22:] # just look at last 16 characters
lat, lon = list(map(float, findall(r"[-+]?\d*\.\d+|\d+", f)))[-2:]
points.append(Point(lat=lat, lon=lon, filename=filename))
return points
# -------------------------------------------------------------------- #
elif memory_mode == 'standard':
# ------------------------------------------------------------ #
# Open VIC files and put data into netcdfs
chunk = Plist()
while points:
point = points.popleft()
point.open()
point.read()
point.close()
chunk.append(point)
if len(chunk) > int(options['chunksize']) or len(points) == 0:
for segment in segments:
segment.nc_add_data_standard(chunk)
chunk = Plist()
del point
# ------------------------------------------------------------ #
# ------------------------------------------------------------ #
# Close the netcdf files
for segment in segments:
segment.nc_close()
# ------------------------------------------------------------ #
elif memory_mode == 'original':
# ------------------------------------------------------------ #
# Run in original memory mode (a.k.a. vic2nc.c mode)
# Open all files
for point in points:
point.open()
while segments: