ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/gen/gensdaymtx.c
(Generate patch)

Comparing ray/src/gen/gensdaymtx.c (file contents):
Revision 1.10 by greg, Fri Jul 11 18:12:25 2025 UTC vs.
Revision 1.13 by greg, Fri Aug 22 01:04:30 2025 UTC

# Line 458 | Line 458 | add_direct
458          double mean = sum / NSSAMP;
459  
460          double intensity = mean * WVLSPAN;
461 <        if (dirnorm > 0) {
461 >        if (dirnorm >= 0) {
462                  intensity = dirnorm / SOLOMG / WHTEFFICACY;
463          }
464          double dir_ratio = 1.;
# Line 479 | Line 479 | add_direct
479                  float *pdest = parr + NSSAMP * near_patch[i];
480                  int k;
481                  for (k = 0; k < NSSAMP; k++) {
482 <                        *pdest++ = sun_radiance[k] * wta[i] / wtot;
482 >                        *pdest++ += sun_radiance[k] * wta[i] / wtot;
483                  }
484          }
485   }
# Line 572 | Line 572 | compute_sky
572  
573          /* diffuse calibration factor */
574          double dif_ratio = 1;
575 <        if (difhor > 0) {
575 >        if (difhor >= 0) {
576                  DATARRAY *indirect_irradiance_clear = get_indirect_irradiance(irrad, radius, sun_ct);
577                  double overcast_ghi = overcast_zenithbr * 7.0 * PI / 9.0;
578                  double diffuse_irradiance = 0;
# Line 616 | Line 616 | main
616          int tstorage = 0;                                           /* number of allocated time steps */
617          int nstored = 0;                                            /* number of time steps in matrix */
618          int last_monthly = 0;                                       /* month of last report */
619 <        double dni;                                                 /* direct normal illuminance */
620 <        double dhi;                                                 /* diffuse horizontal illuminance */
619 >        double dni = -1.0;                                                 /* direct normal illuminance */
620 >        double dhi = -1.0;                                                 /* diffuse horizontal illuminance */
621  
622          float           *mtx_data = NULL;
623          int mtx_offset = 0;
# Line 764 | Line 764 | main
764          DATARRAY *mie_dp = getdata(mie_path);
765          if (mie_dp == NULL) {
766                  fprintf(stderr, "Error reading mie data\n");
767 <                return 0;
767 >                return 1;
768          }
769  
770          if (epw->isWEA == WEAnot) {
# Line 861 | Line 861 | main
861                          fprintf(stderr, "# Pre-computing...\n");
862                          if (!precompute(sorder, clear_paths, &clear_atmos, num_threads)) {
863                                  fprintf(stderr, "Pre-compute failed\n");
864 <                                return 0;
864 >                                return 1;
865                          }
866                  }
867  
# Line 939 | Line 939 | main
939                  case 'f':
940                          for (j = 0; j < nstored; j++) {
941                                  float ment[NSSAMP];
942 <                                for (k = NSSAMP - 1; k >= 0; k--) {
943 <                                        ment[k] = mtx_data[mtx_offset + k];
942 >                                for (k = 0; k < NSSAMP; k++) {
943 >                                        ment[NSSAMP-1 - k] = mtx_data[mtx_offset + k];
944                                  }
945                                  putbinary(ment, sizeof(float), NSSAMP, stdout);
946                                  mtx_offset += NSSAMP * nskypatch;
# Line 949 | Line 949 | main
949                  case 'd':
950                          for (j = 0; j < nstored; j++) {
951                                  double ment[NSSAMP];
952 <                                for (k = NSSAMP - 1; k >= 0; k--) {
953 <                                        ment[j] = mtx_data[mtx_offset + k];
952 >                                for (k = 0; k < NSSAMP; k++) {
953 >                                        ment[NSSAMP-1 - k] = mtx_data[mtx_offset + k];
954                                  }
955                                  putbinary(ment, sizeof(double), NSSAMP, stdout);
956                                  mtx_offset += NSSAMP * nskypatch;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines