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

Add argument dirname

parent 12bd0d95
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import shapefile
import numpy as np
import matplotlib.pyplot as plt
import itertools
from os import path
def plot_distr_funct(x, label = None, ax = None):
"""Sort and plot distribution function. x should be a Numpy array."""
......@@ -19,19 +20,22 @@ def plot_distr_funct(x, label = None, ax = None):
print("number of values:", nx, "\n")
def read():
"""Read the three dbf files and return speed, radius and amplitude of
outermost contour, radius and amplitude of maximum speed contour,
as Numpy arrays.
def read(dirname):
"""Read the three dbf files in dirname and return speed, radius and
amplitude of outermost contour, radius and amplitude of maximum
speed contour, as Numpy arrays.
Select valid speed values and valid outermost contour (with
sufficient area).
"""
extr_file = path.join(dirname, "extremum")
outer_file = path.join(dirname, "outermost_contour")
max_speed_file = path.join(dirname, "max_speed_contour")
with shapefile.Reader("extremum") as extremum, \
shapefile.Reader("outermost_contour") as outerm_cont, \
shapefile.Reader("max_speed_contour") as max_speed_cont:
with shapefile.Reader(extr_file) as extremum, \
shapefile.Reader(outer_file) as outerm_cont, \
shapefile.Reader(max_speed_file) as max_speed_cont:
speed = []
rad_outer = []
rad_speed = []
......@@ -124,6 +128,8 @@ def plot_all(dict_list, label = None):
label)
if __name__ == "__main__":
d = read()
import sys
d = read(sys.argv[1])
plot_all([d])
plt.show()
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