Coder Social home page Coder Social logo

udst / urbansim_defaults Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 12.0 396 KB

Some starter models and functionality to use with UrbanSim

Home Page: https://udst.github.io/urbansim_defaults/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

urbansim_defaults's People

Contributors

alephcero avatar cvanegas avatar fscottfoti avatar hanase avatar janowicz avatar jiffyclub avatar smmaurer avatar tbuckl avatar waddell avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

urbansim_defaults's Issues

na check error doesn't show which data frame has NA's (in ipython notebook)

this check here could maybe work better: https://github.com/synthicity/urbansim_defaults/blob/ec68a0b2fff79c66f00bc63c8232e55c580cce41/urbansim_defaults/utils.py#L78-L81

at line 78, it seems like it would print out which data frame has NA's. but i don't think it actually does. (see the output below). i ran into this while having a config file with NA's as parameters (as output by Estimation.ipynb)

it looks like this (at least in a notebook, not sure about python):


AssertionError Traceback (most recent call last)
in ()
27 #"pusher", # push results to the web client
28 #"clear_cache" # clear the cache each year
---> 29 ], years=range(in_year, out_year))
30 print "Finished", time.ctime()

d:\urbansim_windows\urbansim\urbansim\sim\simulation.pyc in run(models, years, data_out, out_interval)
1524 model = get_model(model_name)
1525 t2 = time.time()
-> 1526 model()
1527 print("Time to execute model '{}': {:.2f}s".format(
1528 model_name, time.time()-t2))

d:\urbansim_windows\urbansim\urbansim\sim\simulation.pyc in call(self)
679 kwargs = _collect_variables(names=self._argspec.args,
680 expressions=self._argspec.defaults)
--> 681 return self._func(**kwargs)
682
683 def _tables_used(self):

d:\urbansim_windows\urbansim_defaults\urbansim_defaults\models.pyc in hlcm_simulate(households, buildings, aggregations, settings)
46 "building_id","residential_units",
47 "vacant_residential_units",
---> 48 settings.get("enable_supply_correction", None))
49
50

d:\urbansim_windows\urbansim_defaults\urbansim_defaults\utils.pyc in lcm_simulate(cfg, choosers, buildings, join_tbls, out_fname, supply_fname, vacant_fname, enable_supply_correction)
337 additional_columns +=[enable_supply_correction["price_col"]]
338 locations_df = to_frame(buildings, join_tbls, cfg,
--> 339 additional_columns=additional_columns)
340
341 available_units = buildings[supply_fname]

d:\urbansim_windows\urbansim_defaults\urbansim_defaults\utils.pyc in to_frame(tbl, join_tbls, cfg, additional_columns)
193 else:
194 df = tables[0].to_frame(columns)
--> 195 check_nas(df)
196 return df
197

d:\urbansim_windows\urbansim_defaults\urbansim_defaults\utils.pyc in check_nas(df)
79 (df_cnt-s_cnt, df_cnt, col)
80
---> 81 assertnot fail, "NAs were found in dataframe, please fix"
82
83

missing reindexes on building variables/columns?

I believe the value count results will be sorted based on frequency (descending) so I don't see how this would align with the buildings. Seems like you will need to reindex the count results before the subtract?

@orca.column('buildings', 'vacant_residential_units')
def vacant_residential_units(buildings, households):
    return buildings.residential_units.sub(
        households.building_id.value_counts(), fill_value=0)


@orca.column('buildings', 'vacant_job_spaces')
def vacant_job_spaces(buildings, jobs):
    return buildings.job_spaces.sub(
        jobs.building_id.value_counts(), fill_value=0)

Deprecation warning about yaml.load

/urbansim_defaults/urbansim_defaults/utils.py:222: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  model_type = yaml.load(open(cfg))["model_type"]

Might be changed to yaml.load(open(cfg), Loader=yaml.FullLoader)["model_type"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.