ladybug-tools / radiance-folder-structure

⚡️📂Folder structure for Radiance studies
GNU Lesser General Public License v3.0
0 stars 2 forks source link

Why are strings used to identify the order of states instead of integers or a list #15

Closed chriswmackey closed 4 years ago

chriswmackey commented 4 years ago

Here is the sample given for a states.json file in this repo:

{
  "south_window": {
    "0": {
      "name": "clear",
      "default": "./south_window..default..000.rad",
      "direct": "./south_window..direct..000.rad",
      "black": "./south_window..black.rad",
      "tmtx": "clear.xml",
      "vmtx": "./south_window..mtx.rad",
      "dmtx": "./south_window..mtx.rad"
    },
    "1": {
      "name": "diffuse",
      "default": "./south_window..default..001.rad",
      "direct": "./south_window..direct..001.rad",
      "black": "./south_window..black.rad",
      "tmtx": "diffuse50.xml",
      "vmtx": "./south_window..mtx.rad",
      "dmtx": "./south_window..mtx.rad"
    }
  }
}

What seems odd to me is that we are using the strings "0", "1", etc. to note the order of states. Is there a reason why these were chosen instead of just integers (eg. 0, 1)? Is the assumption that any string can be used in place of this string integer? And we figure out the order of states by sorting the strings alphanumerically?

Or better yet, why not just use a list to denote the order that states are supposed to happen in as opposed to a dictionary with integers? Is the assumption that, by using a dictionary, it is ok to have a gap in the order of states, so I can jump from state 0 to state 2 without any state 1?

mostaphaRoudsari commented 4 years ago

I'm not sure why did I put strings there. Using integers or lists are fine. List will probably make it more readable as you suggested. I'm good with using a list instead.

chriswmackey commented 4 years ago

Sounds good. I'll set honeybee-radiance up to use lists now and we'll leave this issue open here until we can change the samples.

chriswmackey commented 4 years ago

This has been addressed via https://github.com/ladybug-tools/radiance-folder-structure/pull/16