Urban-Analytics / RAMP-UA

https://urban-analytics.github.io/RAMP-UA/
MIT License
15 stars 10 forks source link

Population caches not being read properly #291

Closed nickmalleson closed 3 years ago

nickmalleson commented 3 years ago

Population caches (activity_locations.pkl and individuals.pkl) are always re-read regardless of whether they exist or not

github-actions[bot] commented 3 years ago

Branch nickmalleson-issue-291 created!

nickmalleson commented 3 years ago

There may have been no problem after all, but I added an os.path.join here anyway as I think it's more reliable and it seems to work for me now

https://github.com/Urban-Analytics/RAMP-UA/blob/e739543102f58e22cfd4492395d18a5360d5b8d3/microsim/main.py#L183

Sparrow0hawk commented 3 years ago

Hi @nickmalleson, can you provide a little bit more detail on this issue? The change to using os.path.join is an absolutely sensible one but i'm not quite sure whether that will solve an underlying issue you've encountered.

nickmalleson commented 3 years ago

Sorry for the confusion @Sparrow0hawk , I wasn't able to reproduce the original issue when I came to fix it. Basically at some point there was a line like cache_dir=os.path.join(data_dir, "/caches/"); the slashes on caches caused the path to be set to ROOT/caches. But when I came to fix it the line had been changed to string concatenation (something like cache_dir=data_dir +"/caches/")) which works OK. I changed it to os.path.join because I figured that was better practice anyway, but could not work out how I had found the original bug. Probably a mistake on my part with branch versions.