ucd-cws / calvin-network-tools

Command line tools for calvin-network-data and calvin-network-app. Includes prm tool for export PRI and DSS files
MIT License
3 stars 5 forks source link

debug mode broken for matrix export #51

Closed jdherman closed 7 years ago

jdherman commented 7 years ago

@jrmerz @mfefer

using the new v.3.0.2, the usual matrix export works great. 82-year model solves without issue.

But exporting in debug mode seems to be broken. For example:

cnf matrix --format csv --start 1921-10 --stop 2003-10 --ts . --to links --max-ub 1000000000000 --verbose --debug=ALL

returns:

*** matrix Input Parameters ***
{
  "_": [
    "matrix"
  ],
  "help": false,
  "no-header": false,
  "N": false,
  "noHeader": false,
  "verbose": true,
  "v": true,
  "format": "csv",
  "f": "csv",
  "start": "1921-10",
  "s": "1921-10",
  "stop": "2003-10",
  "t": "2003-10",
  "ts": ".",
  "S": ".",
  "to": "links",
  "T": "links",
  "max-ub": 1000000000000,
  "M": 1000000000000,
  "maxUb": 1000000000000,
  "debug": "ALL",
  "data": "ALL",
  "d": "ALL",
  "fs": ",",
  "F": ",",
  "config": "/Users/jon",
  "c": "/Users/jon",
  "$0": "/usr/local/bin/cnf",
  "nodes": [],
  "runtime": "/usr/local/lib/node_modules/calvin-network-tools/HEC_Runtime"
}
**********************

Running matrix command.

fs.js:871
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir '/Users/jon/Dropbox/code/pyvin/ALL'
    at Object.fs.readdirSync (fs.js:871:18)
    at read (/usr/local/lib/node_modules/calvin-network-tools/node_modules/hobbes-network-format/lib/crawler/fast-walk.js:7:21)
    at module.exports (/usr/local/lib/node_modules/calvin-network-tools/node_modules/hobbes-network-format/lib/crawler/fast-walk.js:35:3)
    at module.exports (/usr/local/lib/node_modules/calvin-network-tools/node_modules/hobbes-network-format/lib/crawler/prepareNetwork.js:11:20)
    at crawler (/usr/local/lib/node_modules/calvin-network-tools/node_modules/hobbes-network-format/lib/crawler/index.js:16:22)
    at Object.module.exports [as split] (/usr/local/lib/node_modules/calvin-network-tools/node_modules/hobbes-network-format/lib/split.js:48:5)
    at matrix (/usr/local/lib/node_modules/calvin-network-tools/nodejs/matrix/index.js:44:7)
    at module.exports (/usr/local/lib/node_modules/calvin-network-tools/nodejs/cmds/matrix.js:66:3)
    at runCommand (/usr/local/lib/node_modules/calvin-network-tools/bin/handler.js:57:35)
    at /usr/local/lib/node_modules/calvin-network-tools/bin/handler.js:48:5

This is a wild guess but it looks like the -d flag is being used for both --data and --debug, so maybe it's looking for a data folder called ./ALL ?

jrmerz commented 7 years ago

@jdherman Nice catch. Yup, had a type on the debug flag, it's alt option should be upper case D. I pushed a fix to github. Will update on npm in a bit.

jrmerz commented 7 years ago

pushed to NPM calvin-network-tools@3.0.3

jdherman commented 7 years ago

Thanks! works now.

@mfefer the debug mode also seems to work with pyomo, so I'm not sure what happened the other day but it seems ok now.