problem of gencumulativesky driven through Python

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!

···

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](http://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
  1. 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 ...
  1. 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

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](http://www.radiance-online.org/mailman/listinfo/radiance-general)
_______________________________________________ Radiance-general mailing list

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

···

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:


    --------

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



    <small>process.wait()</small>

      </small></small>      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

https://commons.lbl.gov/x/_591B
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](http://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
  1. 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 ...
  1. 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

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](http://www.radiance-online.org/mailman/listinfo/radiance-general)
_______________________________________________ Radiance-general mailing list

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

_______________________________________________ Radiance-general mailing list

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