htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit 0ab02d8283977bdd9a29e0dd8f392d0201257fde
parent a9551f9de1a1cbd49306738e13a10bf768548eb9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 20 Mar 2020 10:22:04 +0100

Compute the brightness temperature in Long Wave rendering

Diffstat:
Msrc/htrdr.c | 9+++++----
Msrc/htrdr.h | 2+-
Msrc/htrdr_draw_radiance.c | 28++++++++++++++++++++++++++--
3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/htrdr.c b/src/htrdr.c @@ -140,9 +140,10 @@ dump_accum_buffer if(htsky_is_long_wave(htrdr->sky)) { const struct htrdr_pixel_lw* pix = htrdr_buffer_at(buf, x, y); + fprintf(stream, "%g %g ", + pix->radiance_temperature.E, pix->radiance_temperature.SE); fprintf(stream, "%g %g ", pix->radiance.E, pix->radiance.SE); - fprintf(stream, "%g %g ", pix->radiance.E, pix->radiance.SE); - fprintf(stream, "%g %g ", pix->radiance.E, pix->radiance.SE); + fprintf(stream, "0 0 "); pix_time_acc = &pix->time; } else { @@ -563,8 +564,8 @@ htrdr_init iband1 = htsky_get_spectral_band_id(htrdr->sky, nbands-1); HTSKY(get_spectral_band_bounds(htrdr->sky, iband0, wlen0)); HTSKY(get_spectral_band_bounds(htrdr->sky, iband1, wlen1)); - htrdr->wlen_range[0] = wlen0[0]; - htrdr->wlen_range[1] = wlen1[1]; + htrdr->wlen_range_m[0] = wlen0[0]*1e-9; /* Convert in meters */ + htrdr->wlen_range_m[1] = wlen1[1]*1e-9; /* Convert in meters */ if(htsky_is_long_wave(htrdr->sky)) { /* Define the CDF used to sample a long wave band */ diff --git a/src/htrdr.h b/src/htrdr.h @@ -54,7 +54,7 @@ struct htrdr { struct htrdr_buffer* buf; struct htsky* sky; - double wlen_range[2]; /* Integration range in nanometers */ + double wlen_range_m[2]; /* Integration range in *meters* */ struct darray_double lw_cdf; /* CDF to sample a Long Waves band */ diff --git a/src/htrdr_draw_radiance.c b/src/htrdr_draw_radiance.c @@ -611,6 +611,7 @@ draw_pixel_lw struct htrdr_accum radiance; struct htrdr_accum time; size_t isamp; + double temp_min, temp_max; ASSERT(ipix && ipix && pix_sz && cam && rng && pixel); ASSERT(htsky_is_long_wave(htrdr->sky)); @@ -667,10 +668,33 @@ draw_pixel_lw time.nweights += 1; } - /* Flush pixel data */ + /* Compute the estimation of the pixel radiance */ htrdr_accum_get_estimation(&radiance, &pixel->radiance); - pixel->radiance_temperature = HTRDR_ESTIMATE_NULL; /* TODO */ + + /* Save the per realisation integration time */ pixel->time = time; + + /* Compute the brightness_temperature of the pixel and estimate its standard + * error */ + #define BRIGHTNESS_TEMPERATURE(Radiance, Temperature) { \ + res_T res = brightness_temperature \ + (htrdr, \ + htrdr->wlen_range_m[0], \ + htrdr->wlen_range_m[1], \ + (Radiance), \ + &(Temperature)); \ + if(res != RES_OK) { \ + htrdr_log_warn(htrdr, \ + "Could not compute the brightness temperature for the radiance %g.\n", \ + (Radiance)); \ + (Temperature) = 0; \ + } \ + } (void)0 + BRIGHTNESS_TEMPERATURE(pixel->radiance.E, pixel->radiance_temperature.E); + BRIGHTNESS_TEMPERATURE(pixel->radiance.E - pixel->radiance.SE, temp_min); + BRIGHTNESS_TEMPERATURE(pixel->radiance.E + pixel->radiance.SE, temp_max); + pixel->radiance_temperature.SE = temp_max - temp_min; + #undef BRIGHTNESS_TEMPERATURE } static res_T