# Unexpected results from gendaymtx

**URL:** <https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376>\
**Category:** radiance-general\
**Created:** [October 18, 2023, 8:23pm UTC](https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376 "2023-10-18T20:23:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrhe](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/7ab992/32.png) [@mrhe](https://discourse.radiance-online.org/u/mrhe)\
**Post date:** [October 18, 2023, 8:23pm UTC](https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376/1 "2023-10-18T20:23:22Z")

</div>

Hi Community,

first of all thank you for creating and maintaining this great package and the corresponding documentation!

I’m working with `gendaymtx.exe` on Windows to get the total solar radiation for sky patches.

```auto
gendaymtx -m 1 -O1 south.wea > south.mtx

```

The resulting `mtx` file has the following header:

```auto
#?RADIANCE
gendaymtx -m 1 -O1 south.wea
LATLONG= -54.50000000 158.94000000
NROWS=146
NCOLS=8760
NCOMP=3
FORMAT=ascii

0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
4 4 4
8.9 8.9 8.9
14.9 14.9 14.9
23.3 23.3 23.3
31.1 31.1 31.1
36.8 36.8 36.8
39.6 39.6 39.6
41.5 41.5 41.5
45.1 45.1 45.1
46.4 46.4 46.4
...

```

I’d expect 146 \* 8760 = 1.278.960 rows with data in this file, but there are 1.279.105 entries.

What do the additional 145 (1.279.105 - 1.278.96) entries correspond to?

---

<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:** [October 18, 2023, 8:44pm UTC](https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376/2 "2023-10-18T20:44:09Z")

</div>

If you are just counting lines in the file, there are some blank lines in between rows. Is it possible you are counting those as well?

Otherwise, please upload your .wea file somewhere, so I can figure out what is going on.

Cheers,  
-Greg

---

<div class="post-metadata">

**Author:** ![mrhe](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/7ab992/32.png) [@mrhe](https://discourse.radiance-online.org/u/mrhe)\
**Post date:** [October 18, 2023, 9:10pm UTC](https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376/3 "2023-10-18T21:10:46Z")

</div>

Thanks for a prompt response @Greg_Ward!

I did count the lines in the output file indeed. Following your tip, I inspected further in Notepad++ and every 8760 entries, there is an empty line which I assume separates values between individual patches.

Thanks again for clarifying this!

A follow-up question on how to convert these values to W/m2. I dug up your [old conversation with Mustafa](https://discourse.radiance-online.org/t/gendaymtx-returns-1-j-1-j-1-j/3463/5) on solid angle values per patch and am trying to get solid angle values per each Tregenza patch.

In Ladybug’s code I can see a reference to [solid angles per row](https://www.ladybug.tools/ladybug-radiance/docs/ladybug_radiance.skymatrix.html#ladybug_radiance.skymatrix.SkyMatrix.PATCHES_PER_ROW) but I’d like to understand how these were obtained with `rcalc` and the `tregenza.cal` file.

---

<div class="post-metadata">

**Author:** ![mrhe](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/7ab992/32.png) [@mrhe](https://discourse.radiance-online.org/u/mrhe)\
**Post date:** [October 18, 2023, 9:18pm UTC](https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376/4 "2023-10-18T21:18:21Z")

</div>

Ah, passing 1 subdivision to the command generates individual values for the default Tregenza sky patches:

```auto
cnt 145 | rcalc -e MF:1 -f reinsrc.cal -e Rbin=recno;$1=Romega > rh_sang.txt

```

---

<div class="post-metadata">

**Author:** ![mrhe](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/7ab992/32.png) [@mrhe](https://discourse.radiance-online.org/u/mrhe)\
**Post date:** [October 18, 2023, 9:29pm UTC](https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376/5 "2023-10-18T21:29:01Z")

</div>

My apologies for spamming this topic but I have one more question:  
@Mostapha is applying the following weights to each of the RGB bands:

```auto
w_val = 0.265074126 * float(R) + 0.670114631 * float(G) + 0.064811243 * float(B)

```

Where do these values come from?  
Here is more context:

 ![image](https://discourse.radiance-online.org/uploads/default/original/2X/e/e2b055179a5e36010e7bd494f8584042dbbf6961.png)

---

<div class="post-metadata">

**Author:** ![mrhe](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/7ab992/32.png) [@mrhe](https://discourse.radiance-online.org/u/mrhe)\
**Post date:** [October 19, 2023, 9:48am UTC](https://discourse.radiance-online.org/t/unexpected-results-from-gendaymtx/6376/6 "2023-10-19T09:48:09Z")

</div>

Having done more research, I found this:

> <https://github.com/NREL/Radiance/blob/2fcca99ace2f2435f32a09525ad31f2b3be3c1bc/src/common/color.h#L110>

For anyone who was wondering like me: these are the default coefficients to convert from RGB in the CIE color space to a single greyscale value representing radiation.
