Skip to content
Snippets Groups Projects
Commit ec3e4807 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Add argument d to function `write_to_shp`

Clearer, instead of accessing global variable d.
parent 0220c96e
No related branches found
No related tags found
No related merge requests found
......@@ -45,13 +45,13 @@ def define_fields(writers):
writers["max_speed"].field("days_1950", "N", 5)
writers["max_speed"].field("eddy_index", "N", 5)
def write_to_shp(writers, cyclone, cell = None, X = None, Y = None, ADT = None,
cell_mask = None):
def write_to_shp(writers, cyclone, d, cell = None, X = None, Y = None,
ADT = None, cell_mask = None):
"""Write to shapefiles eddies with a given orientation, at a given
date.
writers is a dictionary. cyclone is a boolean. cell is a
numpy.ndarray with shape (number of eddies including ghosts,
writers is a dictionary. cyclone is a boolean. d is an int. cell
is a numpy.ndarray with shape (number of eddies including ghosts,
21). X and Y are numpy one-dimensional arrays containing
longitudes and latitudes of the SSH grid. ADT is a numpy
two-dimensional array containing SSH. cell_mask is a numpy boolean
......@@ -192,7 +192,7 @@ while True:
else:
cell_mask = itertools.repeat(False) # no ghost
write_to_shp(factory["writers"], factory["cyclone"],
write_to_shp(factory["writers"], factory["cyclone"], d,
matlab_data[factory["cell_name"]], matlab_data["X"],
matlab_data["Y"], matlab_data["ADT"], cell_mask)
......@@ -201,7 +201,7 @@ while True:
print("Missing file:", adt_file)
for factory in factories:
write_to_shp(factory["writers"], factory["cyclone"])
write_to_shp(factory["writers"], factory["cyclone"], d)
my_date += datetime.timedelta(1)
if my_date > final_date: break
......
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