Closed DavidOry closed 4 years ago
Ah, no. I think the problem is in the get_base_dir
method definition. How does this method allow an argument to be taken in?
The functionality I want is:
parameters = Parameters(lasso_base_dir = input_dir)
add this to your config yaml:
my_parameters:
lasso_base_dir: "D:/lasso" # or where your lasso directory is
How does this method allow an argument to be taken in?
get_base_dir(lasso_base_dir = os.getcwd())
allows a keyword argument to be fed in (which you can do in the Parameters initialization), but it will default to the current working directory.
The parameters keyword lasso_base_dir
is essentially put through a process to check and see if the met council data is where it should be and will search around a bit (3 levels for now) if it can't find it.
@DavidOry - is this still an issue?
Yes. @i-am-sijia and I discussed. When passing a dir to Parameters, like this:
parameters = Parameters(lasso_base_dir = input_dir)
I want Parameters to use the defaults and update lasso_base_dir
. This behavior works via the config file, but I don't want to use a config file.
I'm getting error when specifying this way:
parameters = Parameters(lasso_base_dir = "z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities" )
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-385-34813c6beb5e> in <module>
1 model_road_net = ModelRoadwayNetwork.from_RoadwayNetwork(
2 my_scenario.road_net, #parameters=my_config.get("my_parameters", {}),
----> 3 parameters = Parameters(lasso_base_dir = "z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities" )
4 )
5
z:\data\users\sijia\met_council\github\client_met_council_wrangler_utilities\lasso\roadway.py in from_RoadwayNetwork(roadway_network_object, parameters)
112 roadway_network_object.links_df,
113 roadway_network_object.shapes_df,
--> 114 parameters=parameters,
115 )
116
z:\data\users\sijia\met_council\github\client_met_council_wrangler_utilities\lasso\roadway.py in __init__(self, nodes, links, shapes, parameters)
38
39 # will have to change if want to alter them
---> 40 self.parameters = Parameters(**parameters)
41
42 self.links_metcouncil_df = None
TypeError: type object argument after ** must be a mapping, not Parameters
I'm looking at the piece here
Yes, that is my error as well.
Perhaps:
self.parameters = Parameters(**parameters.__dict__)
test_roadway_project = Project.create_project(
base_roadway_dir=os.path.join(EX_DIR,"FullNet_72320"),
roadway_log_file=os.path.join(EX_DIR,"FullNet_72320","randomtestedit.LOG"),
parameters = {'lasso_base_dir' = YOUR_LASSO_DIRECTORY_HERE}
)
Works and I just added/pushed. a test to confirm.
The parameters kw accepts a dict, not a params instance.
I can update it to be more flexible as part of #92
done with. this now?
In this line, should the code read:
The
get_base_dir
method as an argument namedlasso_base_dir
and the name of the variable inkwargs
islasso_base_dir
.