Closed atkamal closed 3 years ago
SGP_Singapore.486980_IWEC.epw
is from https://github.com/ladybug-tools/uwg/tree/master/tests/epwinitialize_singapore.uwg
is from https://github.com/ladybug-tools/uwg/tree/master/tests/parametersPut those two files next to your Python file.
Thank you for your help.
Hello !
I tried running the updated code and am getting the following error.
_**File "C:\Users\athar.kamal\uwg\uwg\uwg.py", line 1472, in _read_input self._init_param_dict[row[0]] = float(row[1])
IndexError: list index out of range**_
Also, when i run the test, I get the following as failed
_-- Docs: https://docs.pytest.org/en/stable/warnings.html =========================== short test summary info =========================== FAILED ..\tests\test_cli.py::test_model_validate - AssertionError: Model vali... FAILED ..\tests\test_cli.py::test_param_validate - AssertionError: Validating... FAILED ..\tests\test_cli.py::test_uwg_simulate - AssertionError: Usage: simul... FAILED ..\tests\test_cli.py::test_custom_uwg_simulate - AssertionError: Usage... FAILED ..\tests\test_cli.py::test_param_simulate - AssertionError: Usage: sim... ============= 5 failed, 62 passed, 1 warning in 105.05s (0:01:45) =============_
One of my programmer colleagues is telling me that the errors might be because of running python on windows. Is that the case?
Is there a reason why you are trying to run the UWG from the repo? You can just pip install it and avoid system path errors.
On Mon., Nov. 9, 2020, 7:50 a.m. atkamal, notifications@github.com wrote:
Hello !
I tried running the updated code and am getting the following error.
_**File "C:\Users\athar.kamal\uwg\uwg\uwg.py", line 1472, in _read_input self._init_param_dict[row[0]] = float(row[1])
IndexError: list index out of range**_
Also, when i run the test, I get the following as failed
-- Docs: https://docs.pytest.org/en/stable/warnings.html https://docs.pytest.org/en/stable/warnings.html =========================== short test summary info =========================== FAILED ..\tests\test_cli.py::test_model_validate - AssertionError: Model vali... FAILED ..\tests\test_cli.py::test_param_validate - AssertionError: Validating... FAILED ..\tests\test_cli.py::test_uwg_simulate - AssertionError: Usage: simul... FAILED ..\tests\test_cli.py::test_custom_uwg_simulate - AssertionError: Usage... FAILED ..\tests\test_cli.py::test_param_simulate - AssertionError: Usage: sim... ============= 5 failed, 62 passed, 1 warning in 105.05s (0:01:45) =============
One of my programmer colleagues is telling me that the errors might be because of running python on windows. Is that the case?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ladybug-tools/uwg/issues/139#issuecomment-723992946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM3TRA2IPVDCNV54BISFF3SO7QSZANCNFSM4TIUMLDA .
@atkamal
Actually, now that I look at your error, it looks like there might be something wrong in your uwg parameter file. Are you using the initialize_singapore.uwg file?
I still think it would be good idea to pip install the uwg if you're not planning on modifying the code. So go to your command line and install UWG with:
pip install uwg
Then the UWG will be available anywhere from python. That's usually a common cause of errors for beginners.
Hi Saeran,
I did install it through pip.
But the errors still persist. I am using the initialize_singapore.uwg and the epw files jumpyapple recommended above.
Can you let me know which python version and ide you're using? I have tried it in both jupyter notebook and spyder with python 3.8.3.
Also, do you think the initialize files get corrupted during the download?
I am downloading the files and giving the specific path to the file. Do I have to put it in the uwg folder?
@atkamal
The version could be the issue, right now we're testing the UWG with versions: 2.7, 3.6, and 3.7
I don't think the initialize files could have been corrupted, since they're just plain text. Providing the specific path to the file will work fine. The UWG will raise an error at initialization if it can't find the files you've specified, so this can't be the error.
If it's still giving you an error update your uwg installation by typing pip install -U uwg
in your command line. I've made a change to the portion of the code giving you issues that will give us a more useful error message. Copy and paste the error message and we can reevaluate. ~(Just ensure the PR here is closed, the code hasn't been merged at the the time I'm writing this).~ (It's merged).
Finally, you may notice that I modified the README example to import uwg as from uwg import UWG
rather then the previous from uwg.uwg import UWG
. You don't have to change this. Either way will work, I just prefer the simpler version.
Hi Saeran,
I ran the updated version and got back the following error.
Error while reading parameter at row 5. Got: ['<!doctypehtml>']. list index out of range
@atkamal
Perfect, now we know what the issue is. Somehow the uwg parameter file you're using has html code which UWG doesn't recognize as a valid input. Check your file, it should be on line number 5.
Copy and paste the plain text from here: https://raw.githubusercontent.com/ladybug-tools/uwg/master/tests/parameters/initialize_singapore.uwg
Or just copy and paste the initialize_singapore.uwg file in the uwg/resources directory. Either should work.
Hi @saeranv
Well I am now getting the following error.
AssertionError: The sum of reference building fractions defined in bld must equal one. Got: 0.0.
I have checked the text file and the ratio seems to equal to 1. But it's still not working. I have tried it on python 3.6 and 3.7.
Is there a way i can set up all the paramters through the code directly and not through a parameter file?
@atkamal
My best guess is that your input parameter file is not being copied correctly somehow.
You can define the UWG model based on default arguments using the from_para_args method:
from uwg import UWG
epw = 'SGP_Singapore.486980_IWEC.epw'
par = 'initialize_singapore.uwg'
bld = [('largeoffice', 'pst80', 0.4), ('midriseapartment', 'pst80', 0.6)]
UWG.from_param_args(bldheight=10, blddensity=0.5, vertohor=0.8,
grasscover=0.1, treecover=0.1, zone='1A', bld=bld)
model.generate()
model.simulate()
model.write_epw()
The uwg documentation shows all the arguments you can modify: https://www.ladybug.tools/uwg/docs/uwg.uwg.html#uwg.uwg.UWG.from_param_args
Edit: Actually, I should mention there are many ways to define a UWG (from a uwg file, from a dictionary/ json schema, from arguments). You can see all of them in the docs: https://www.ladybug.tools/uwg/docs/uwg.uwg.html#module-uwg.uwg
Hi @saeranv
I managed to run the uwg using the following code:
from uwg import UWG
epw = 'C:\Example\QAT_DOHA-INTL-AP_411700_IW2.epw'
bld = [('largeoffice', 'pst80', 0.4), ('midriseapartment', 'pst80', 0.6)] model= UWG.from_param_args(bldheight=10, blddensity=0.5, vertohor=0.8, grasscover=0.1, treecover=0.1, zone='1A', bld=bld, epw_path=(epw))
model.generate() model.simulate() model.write_epw()
Note, the epw file needed to be changed to another since the one shared by you wasn't working.
PS, I asked another of my colleagues (in Europe) to run the original example, but it isn't working for them either. Do you think there is a problem when you upload the files?
@atkamal what was the error given by the Singapore epw file?
Assuming this is resolved, if not new issue can be opened.
Hi!! My name is Athar and I wanted to run the UWG to understand how it works.
I am a beginner/ novice to python.
I cannot seem to run the example that's mentioned in the page. Would like some guidance on this.
"Here is a Python example that shows how to create and run an Urban Weather Generator object. The example script is available at resources/uwg_example.py. Run it through your command prompt in the main uwg directory with the following: python -m resources.uwg_example
from uwg import uwg
Define the .epw, .uwg filenames to create an uwg object.
uwg will look for the .epw file in the uwg/resources/epw folder,
and the .uwg file in the uwg/resources/parameters folder.
epw_filename = "SGP_Singapore.486980_IWEC.epw" # .epw file name param_filename = "initialize_singapore.uwg" # .uwg file name
Initialize the UWG object and run the simulation
uwg_ = uwg(epw_filename, paramfilename) uwg.run() "