problem of gencumulativesky driven through Python

... to add a bit more info:

1. the same approach of using Python to execute Radiance programs works
fine on another Mac and Windows7 computers

2. I'm using *Python 2.7.9* for Mac

3. The Gencumulativesky executable is probably compiled from the source
code from Daysim3 ... but I'm not sure if it is the latest version ...

4. the Radiance is version *4.3.a.2* installed from
*https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg
<https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg>*

Thanks!

···

On Thu, Feb 19, 2015 at 11:32 AM, Joe Smith <[email protected]> wrote:

Hi, guys,

I don't know if you can kindly advise me on a Python related problem, or
suggest a source for help:

1. the following gencumulativesky command runs OK in the terminal of Mac
OS using London's weather file:
*GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0 -h 0 -E -time 0 24
-date 1 1 12 31 ./London.epw > ./gcs_London.cal*

... with two lines of error message:

*There were 4586 sun up hours in this climate fileTotal Ibh/Lbh: 0.000000*

2. But I can't get it working at all by running a Python script with the
following contents:

*import oscmd = "GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0 -h
0 -E -time 0 24 -date 1 1 12 31 ./London.epw >
./gcs_London.cal"os.system(cmd)*

There is no error message in the Python IDLE, but the .cal file generated
is zero ...

Moreover, I got a lot more error messages when running the
gencumulativesky program directly in the terminal of Mac OS X using
Singapore's weather file:

Command:
*GenCumulativeSky +s1 -a 1.37 -o -103.98 -m -120.0 -h 0 -E -time
0 24 -date 1 1 12 31 ./SGP_Singapore.486980_IWEC.epw > ./gcs_SG.cal*

Errors:

*Error! Solar altitude < 6 degrees and Idh > 10 W/m^2 on day 1!
Attempting to continue!......Error! Solar altitude < 6 degrees and Idh >
10 W/m^2 on day 365! Attempting to continue!There were 4354 sun up hours
in this climate fileTotal Ibh/Lbh: 0.000000*

Thanks for your help!

Joe

I don't have a solution for your problem but on some previous versions of
Mac OS X the standard Python installation had "issues". You could try
installing a custom version from python.org.

Also, I recommend switching to os.popen instead of os.system. You have much
more feedback from the output stream and any errors that show up.
Converting the code is usually very easy.

Regards,
Thomas

···

On Wed, Feb 18, 2015 at 10:43 PM, Joe Smith <[email protected]> wrote:

... to add a bit more info:

1. the same approach of using Python to execute Radiance programs works
fine on another Mac and Windows7 computers

2. I'm using *Python 2.7.9* for Mac

3. The Gencumulativesky executable is probably compiled from the source
code from Daysim3 ... but I'm not sure if it is the latest version ...

4. the Radiance is version *4.3.a.2* installed from *https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg
<https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg>*

Thanks!

On Thu, Feb 19, 2015 at 11:32 AM, Joe Smith <[email protected]> > wrote:

Hi, guys,

I don't know if you can kindly advise me on a Python related problem, or
suggest a source for help:

1. the following gencumulativesky command runs OK in the terminal of Mac
OS using London's weather file:
*GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0 -h 0 -E -time 0 24
-date 1 1 12 31 ./London.epw > ./gcs_London.cal*

... with two lines of error message:

*There were 4586 sun up hours in this climate fileTotal Ibh/Lbh: 0.000000*

2. But I can't get it working at all by running a Python script with the
following contents:

*import oscmd = "GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0 -h
0 -E -time 0 24 -date 1 1 12 31 ./London.epw >
./gcs_London.cal"os.system(cmd)*

There is no error message in the Python IDLE, but the .cal file generated
is zero ...

Moreover, I got a lot more error messages when running the
gencumulativesky program directly in the terminal of Mac OS X using
Singapore's weather file:

Command:
*GenCumulativeSky +s1 -a 1.37 -o -103.98 -m -120.0 -h 0 -E -time
0 24 -date 1 1 12 31 ./SGP_Singapore.486980_IWEC.epw > ./gcs_SG.cal*

Errors:

*Error! Solar altitude < 6 degrees and Idh > 10 W/m^2 on day 1!
Attempting to continue!......Error! Solar altitude < 6 degrees and Idh >
10 W/m^2 on day 365! Attempting to continue!There were 4354 sun up hours
in this climate fileTotal Ibh/Lbh: 0.000000*

Thanks for your help!

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Thank you, Thomas and Alstan!

I need to check the use of Python's subprocess module.

Anyway, other than Alstan's way of constructing the command, the following
seems working as well. Am I using it correctly?

*import subprocess as spcmd = "GenCumulativeSky +s1 -a 51.15 -o 0.18 -m
-0.0 -h 0 -E -time 0 24 -date 1 1 12 31
./GBR_London.Gatwick.037760_IWEC.epw > ./gcs_LD.cal"process = sp.Popen(cmd,
shell=True)process.wait()print "OK!"*

···

On Fri, Feb 20, 2015 at 3:04 PM, J. Alstan Jakubiec <[email protected]> wrote:

--------
WARNING: At least one of the links in the message below goes to an .exe
file,
which could be malicious. To learn how to protect yourself, please go here:
https://commons.lbl.gov/x/_591B
--------
One correction to my previous post -- it does seem that, as was noted, the
source code is available with Daysim 3. I didn't know that. I would presume
that this is the corrected version, but I do not know for sure. If flipping
your longitude input gives you better results, then it isn't.

Alstan

On 2/20/2015 2:42 PM, J. Alstan Jakubiec wrote:

--------
WARNING: At least one of the links in the message below goes to an .exe
file,
which could be malicious. To learn how to protect yourself, please go here:
https://commons.lbl.gov/x/_591B
--------
Hi Joe,

I haven't automated gencumulativesky through Python, but I do a fair
amount of automation of Radiance commands using Python. I find that most
commands will not work unless you run the command with shell emulation
enabled. I'm not familiar with os.system or os.popen, but this is an
example of my process using the subprocess module, and I hope it helps you.

import subprocess as sp

process = sp.Popen(['pcomb', '-e', '(expresssion)', fullpath_hdr_fname,
'|', 'pvalue', '-d', '-b', '-h', '-H', '>', 'tmp.txt'], *shell=True*)

process.wait()

Note that the subprocess Popen command takes a list of individual command
elements, and the shell=True portion is crucial.

> *Moreover, I got a lot more error messages when running the
gencumulativesky program directly in the terminal of Mac OS X using
Singapore's weather file:*
I am not sure where the 'official' gencumulative sky is available from
these days, but we noticed an issue way back in 2012 thanks to some sleuthing
from Ji Zhang
<http://diva4rhino.com/forum/topics/gencumulativesky-exe-problem>, and a
patched version was issued. Unfortunately, I only have the Windows binary
of the fixed version, and the code is not open. A kind of dumb fix is to
reverse your longitude input, as I believe the original version had issues
with areas in the eastern hemisphere.

Best,
Alstan

On 2/20/2015 12:21 AM, Thomas Bleicher wrote:

Joe

I don't have a solution for your problem but on some previous versions
of Mac OS X the standard Python installation had "issues". You could try
installing a custom version from python.org.

Also, I recommend switching to os.popen instead of os.system. You have
much more feedback from the output stream and any errors that show up.
Converting the code is usually very easy.

Regards,
Thomas

On Wed, Feb 18, 2015 at 10:43 PM, Joe Smith <[email protected]> > wrote:

  ... to add a bit more info:

1. the same approach of using Python to execute Radiance programs works
fine on another Mac and Windows7 computers

2. I'm using *Python 2.7.9* for Mac

3. The Gencumulativesky executable is probably compiled from the source
code from Daysim3 ... but I'm not sure if it is the latest version ...

4. the Radiance is version *4.3.a.2* installed from *https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg
<https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg>*

Thanks!

On Thu, Feb 19, 2015 at 11:32 AM, Joe Smith <[email protected]> >> wrote:

  Hi, guys,

I don't know if you can kindly advise me on a Python related problem, or
suggest a source for help:

1. the following gencumulativesky command runs OK in the terminal of Mac
OS using London's weather file:
*GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0 -h 0 -E -time 0 24
-date 1 1 12 31 ./London.epw > ./gcs_London.cal*

... with two lines of error message:

*There were 4586 sun up hours in this climate file Total Ibh/Lbh:
0.000000 *

2. But I can't get it working at all by running a Python script with the
following contents:

*import os cmd = "GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0
-h 0 -E -time 0 24 -date 1 1 12 31 ./London.epw > ./gcs_London.cal"
os.system(cmd)*

There is no error message in the Python IDLE, but the .cal file
generated is zero ...

Moreover, I got a lot more error messages when running the
gencumulativesky program directly in the terminal of Mac OS X using
Singapore's weather file:

Command:
*GenCumulativeSky +s1 -a 1.37 -o -103.98 -m -120.0 -h 0 -E
-time 0 24 -date 1 1 12 31 ./SGP_Singapore.486980_IWEC.epw > ./gcs_SG.cal*

Errors:

*Error! Solar altitude < 6 degrees and Idh > 10 W/m^2 on day 1!
Attempting to continue! ...... Error! Solar altitude < 6 degrees and Idh >
10 W/m^2 on day 365! Attempting to continue! There were 4354 sun up hours
in this climate file Total Ibh/Lbh: 0.000000*

Thanks for your help!

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing [email protected]://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing [email protected]://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Sorry, guys, it seems the following works in Windows ONLY.

*import subprocess as spcmd = "GenCumulativeSky +s1 -a 51.15 -o 0.18 -m
-0.0 -h 0 -E -time 0 24 -date 1 1 12 31
./GBR_London.Gatwick.037760_IWEC.epw > ./gcs_LD.cal"process = sp.Popen(cmd,
shell=True)process.wait()*

... on Mac the above only produces an empty .cal file ... (tested via both
Python 2.7 and Python 3.4 for Mac)

Neither do the following which generates no .cal file ...

*process = sp.Popen(['GenCumulativeSky', '+s1', '-a', '51.15', '-o',
'0.18', '-m', '-0.0', '-h', '0', '-E', '-time', '0', '24', '-date', '1',
'1', '12', '31', './GBR_London.Gatwick.037760_IWEC.epw', '>',
'./gcs_LD.cal'], shell=True)*

I'm suspecting something's wrong about the Python installed on my Mac ...

Anyway, it works in Windows at least ...

···

On Sat, Feb 21, 2015 at 11:20 PM, Joe Smith <[email protected]> wrote:

Thank you, Thomas and Alstan!

I need to check the use of Python's subprocess module.

Anyway, other than Alstan's way of constructing the command, the following
seems working as well. Am I using it correctly?

*import subprocess as spcmd = "GenCumulativeSky +s1 -a 51.15 -o 0.18
-m -0.0 -h 0 -E -time 0 24 -date 1 1 12 31
./GBR_London.Gatwick.037760_IWEC.epw > ./gcs_LD.cal"process = sp.Popen(cmd,
shell=True)process.wait()print "OK!"*

On Fri, Feb 20, 2015 at 3:04 PM, J. Alstan Jakubiec <[email protected]> > wrote:

--------
WARNING: At least one of the links in the message below goes to an .exe
file,
which could be malicious. To learn how to protect yourself, please go
here:
https://commons.lbl.gov/x/_591B
--------
One correction to my previous post -- it does seem that, as was noted,
the source code is available with Daysim 3. I didn't know that. I would
presume that this is the corrected version, but I do not know for sure. If
flipping your longitude input gives you better results, then it isn't.

Alstan

On 2/20/2015 2:42 PM, J. Alstan Jakubiec wrote:

--------
WARNING: At least one of the links in the message below goes to an .exe
file,
which could be malicious. To learn how to protect yourself, please go
here:
https://commons.lbl.gov/x/_591B
--------
Hi Joe,

I haven't automated gencumulativesky through Python, but I do a fair
amount of automation of Radiance commands using Python. I find that most
commands will not work unless you run the command with shell emulation
enabled. I'm not familiar with os.system or os.popen, but this is an
example of my process using the subprocess module, and I hope it helps you.

import subprocess as sp

process = sp.Popen(['pcomb', '-e', '(expresssion)', fullpath_hdr_fname,
'|', 'pvalue', '-d', '-b', '-h', '-H', '>', 'tmp.txt'], *shell=True*)

process.wait()

Note that the subprocess Popen command takes a list of individual command
elements, and the shell=True portion is crucial.

> *Moreover, I got a lot more error messages when running the
gencumulativesky program directly in the terminal of Mac OS X using
Singapore's weather file:*
I am not sure where the 'official' gencumulative sky is available from
these days, but we noticed an issue way back in 2012 thanks to some sleuthing
from Ji Zhang
<http://diva4rhino.com/forum/topics/gencumulativesky-exe-problem>, and a
patched version was issued. Unfortunately, I only have the Windows binary
of the fixed version, and the code is not open. A kind of dumb fix is to
reverse your longitude input, as I believe the original version had issues
with areas in the eastern hemisphere.

Best,
Alstan

On 2/20/2015 12:21 AM, Thomas Bleicher wrote:

Joe

I don't have a solution for your problem but on some previous versions
of Mac OS X the standard Python installation had "issues". You could try
installing a custom version from python.org.

Also, I recommend switching to os.popen instead of os.system. You have
much more feedback from the output stream and any errors that show up.
Converting the code is usually very easy.

Regards,
Thomas

On Wed, Feb 18, 2015 at 10:43 PM, Joe Smith <[email protected]> >> wrote:

  ... to add a bit more info:

1. the same approach of using Python to execute Radiance programs works
fine on another Mac and Windows7 computers

2. I'm using *Python 2.7.9* for Mac

3. The Gencumulativesky executable is probably compiled from the source
code from Daysim3 ... but I'm not sure if it is the latest version ...

4. the Radiance is version *4.3.a.2* installed from *https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg
<https://github.com/NREL/Radiance/releases/download/4.3.a.2/radiance-4.3.a-Darwin.dmg>*

Thanks!

On Thu, Feb 19, 2015 at 11:32 AM, Joe Smith <[email protected]> >>> wrote:

  Hi, guys,

I don't know if you can kindly advise me on a Python related problem,
or suggest a source for help:

1. the following gencumulativesky command runs OK in the terminal of
Mac OS using London's weather file:
*GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0 -h 0 -E -time 0
24 -date 1 1 12 31 ./London.epw > ./gcs_London.cal*

... with two lines of error message:

*There were 4586 sun up hours in this climate file Total Ibh/Lbh:
0.000000 *

2. But I can't get it working at all by running a Python script with
the following contents:

*import os cmd = "GenCumulativeSky +s1 -a 51.15 -o 0.18 -m -0.0
-h 0 -E -time 0 24 -date 1 1 12 31 ./London.epw > ./gcs_London.cal"
os.system(cmd)*

There is no error message in the Python IDLE, but the .cal file
generated is zero ...

Moreover, I got a lot more error messages when running the
gencumulativesky program directly in the terminal of Mac OS X using
Singapore's weather file:

Command:
*GenCumulativeSky +s1 -a 1.37 -o -103.98 -m -120.0 -h 0 -E
-time 0 24 -date 1 1 12 31 ./SGP_Singapore.486980_IWEC.epw > ./gcs_SG.cal*

Errors:

*Error! Solar altitude < 6 degrees and Idh > 10 W/m^2 on day 1!
Attempting to continue! ...... Error! Solar altitude < 6 degrees and Idh >
10 W/m^2 on day 365! Attempting to continue! There were 4354 sun up hours
in this climate file Total Ibh/Lbh: 0.000000*

Thanks for your help!

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing [email protected]://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing [email protected]://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general