# Shirley-Chiu sky patches by gendaymtx or genskyvec

**URL:** <https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194>\
**Category:** Uncategorized\
**Created:** [March 16, 2023, 2:48am UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194 "2023-03-16T02:48:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Majid\_Miri](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@Majid\_Miri](https://discourse.radiance-online.org/u/Majid_Miri)\
**Post date:** [March 16, 2023, 2:48am UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194/1 "2023-03-16T02:48:03Z")

</div>

Hi all,

I am just wondering if there is any way to produce a matrix of a sky patch by gendaymtx or genskyvec that is based on the Shirley-Chiu disk-to-square mapping formula instead of Reinhart/Tregenza sky?

Best regards,  
Majid

---

<div class="post-metadata">

**Author:** ![Greg\_Ward](https://discourse.radiance-online.org/user_avatar/discourse.radiance-online.org/greg_ward/32/471_2.png) [@Greg\_Ward](https://discourse.radiance-online.org/u/Greg_Ward)\
**Post date:** [March 16, 2023, 3:24am UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194/2 "2023-03-16T03:24:53Z")

</div>

Hi Majid,

It’s no problem to create a matrix with rfluxmtx that uses a Shirley-Chiu sky mapping, but we don’t provide sky generators that use this subdivision. Both gendaymtx and genskyvec assume Reinhart or Tregenza sky patches. You could generate your own sky samples using disk2square.cal, similar to the way genskyvec.pl in ray/src/util does it. The handling of the sun is a bit tricky, though.

Cheers,  
-Greg

---

<div class="post-metadata">

**Author:** ![Majid\_Miri](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@Majid\_Miri](https://discourse.radiance-online.org/u/Majid_Miri)\
**Post date:** [March 16, 2023, 10:09am UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194/3 "2023-03-16T10:09:57Z")

</div>

Hi Greg,

Thank you so much for the help. Then I will check the genskyvec.pl and try to find a way to generate sky patches with the help of disk2square.cal.

Best regards,  
Majid

---

<div class="post-metadata">

**Author:** ![Stephen\_Wasilewski](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/s/f0a364/32.png) [@Stephen\_Wasilewski](https://discourse.radiance-online.org/u/Stephen_Wasilewski)\
**Post date:** [March 17, 2023, 7:48am UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194/4 "2023-03-17T07:48:50Z")

</div>

Hi Majid,

Look at [raytraverse/skycalc.py at release · stephanwaz/raytraverse · GitHub](https://github.com/stephanwaz/raytraverse/blob/release/raytraverse/sky/skycalc.py). these functions are used by the class sky/skydata.py. I implemented gendaymtx in python but with shirley-chiu disk to square mapping. The other big difference is I do not distribute the solar energy between three patches, instead it only goes to the nearest patch. In my use case, I am assuming that this patch energy is only used for the indirect calculation (combined with a separate direct source run, eg 5-phase, advanced 2-phase/2-phase DDS. I found that the results are more reliable to use a lower division with one patch rather than a higher division with distributed energy (In each case the apparent size of the solar patch is the same with for example a division of 12x12 vs. 15x15)

-Stephen

---

<div class="post-metadata">

**Author:** ![Majid\_Miri](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@Majid\_Miri](https://discourse.radiance-online.org/u/Majid_Miri)\
**Post date:** [March 22, 2023, 1:28am UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194/6 "2023-03-22T01:28:48Z")

</div>

Hi Stephen,

First of all, I should thank you again for your super interesting works and help me about Shirley-Chiu sky patches.  
However, I am not sure how can I write the argument for the skydata if I want to create a npz file with 144 sky patches + 1 for the ground (in total 145) and import the it into the dctimestep.

I wrote a command like this:  
**raytraverse skydata -loc ‘59.7 -18 -15’ -skyres 12 -wea SWE\_Stockholm\_Arlanda.wea | dctimestep rac\_basic\_sample\_project.mtx | rmtxop -fa -t -c 47.4 119.9 11.6 - \> ill\_File**  
But I got these warnings and error messages:  
_/usr/local/lib/python3.10/dist-packages/clasp/click\_ext.py:169: RemovedInSphinx70Warning: The ‘env’ argument to Builder will be required from Sphinx 7._

- builder = sphinx.builders.text.TextBuilder(app)\*  
_Warning! attempting to use skydata from outside scene, make sure scene -outdir is set_  
_fatal - unexpected EOF in header_  
_: cannot load matrix_

So, I do really appreciate it if you can help me with how to solve it.  
It can also help me a lot if you have any links as tutorials for your super interesting app.

Best regards,  
Majid

---

<div class="post-metadata">

**Author:** ![Stephen\_Wasilewski](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/s/f0a364/32.png) [@Stephen\_Wasilewski](https://discourse.radiance-online.org/u/Stephen_Wasilewski)\
**Post date:** [March 23, 2023, 3:01pm UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194/7 "2023-03-23T15:01:59Z")

</div>

Hi Majid,

The output matrix (.npz) is designed for use within raytraverse, and is not directly compatible with radiance. Sorry, I should have made that more clear. There is a scripted option that gets you close:

```auto
import numpy as np
from raytraverse.sky import SkyData

sd = SkyData("SWE_Stockholm_Arlanda.wea", skyres=12)
sd.radiance_sky_matrix("SWE_Stockholm_Arlanda.smx")
# write out skydata mask:
np.savetxt("daymask.txt", sd.daymask, fmt="%d")

```

the you can use your radiance commands:

```auto
dctimestep rac_basic_sample_project.mtx SWE_Stockholm_Arlanda.smx | rmtxop -fa -t -c 47.4 119.9 11.6 - > ill_File

```

one note, SkyData filters on daylight hours defined by the minalt, mindiff, and mindir parameters, so this matrix will not have 8760 rowa. If you know python, you can then read the ill\_File back in and use sd.fill\_data(), or you can print out the masking file and use whatever you want to pad the results (see end of script above, 1 is included, 0 is omitted). Sorry this would be a good idea to implement in the radiance\_sky\_matrix() command, but for now you are second person who has needed it. The documentation (such as it is) is available here ([raytraverse (1.3.10) — raytraverse 1.3.10 documentation](https://raytraverse.readthedocs.io/en/v1.3.10/index.html)), note the latest version docs didn’t build correctly.

---

<div class="post-metadata">

**Author:** ![Majid\_Miri](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@Majid\_Miri](https://discourse.radiance-online.org/u/Majid_Miri)\
**Post date:** [March 24, 2023, 12:56pm UTC](https://discourse.radiance-online.org/t/shirley-chiu-sky-patches-by-gendaymtx-or-genskyvec/6194/8 "2023-03-24T12:56:37Z")

</div>

Hi Stephen,

Your explanation makes everything very clear for me and now it works perfectly.  
Thank you so much for all your helps.

Best regards,  
Maid
