-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New uncertainty characterisation updates #100
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -750,9 +750,17 @@ subroutine def_output_secondary(ncid, dim3d_var, output_data, indexing, & | |
input_dummy2 = 'measurement uncertainty in channel no '// & | ||
trim(adjustl(input_num)) | ||
if (btest(indexing%Ch_Is(i), ThermalBit)) then | ||
input_dummy3 = 'kelvin' | ||
input_dummy='measurement_uncertainty_in_channel_no_'// & | ||
trim(adjustl(input_num)) | ||
input_dummy2='measurement uncertainty in channel no '// & | ||
trim(adjustl(input_num)) | ||
input_dummy3='kelvin' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't these just repeat the block immediately before the |
||
else | ||
input_dummy3 = '1' | ||
input_dummy='measurement_uncertainty_in_channel_no_'// & | ||
trim(adjustl(input_num)) | ||
input_dummy2='measurement uncertainty in channel no '// & | ||
trim(adjustl(input_num)) | ||
input_dummy3='1' | ||
end if | ||
call ncdf_def_var_short_packed_float( & | ||
ncid, & | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,11 @@ | |
! that uses the observed radiance rather than the solar constant to convert | ||
! Solar%NeHomog/Coreg from reflectance into radiance. Additionally, add | ||
! Thermal%NeHomog/Coreg to IDay pixels as well. | ||
! | ||
! 2023/10/10, GT: Introduced Ctrl%use_new_meas_error as the method of switching | ||
! between the old measurement uncertainty characterisation (associated with | ||
! the old text-based LUTs) and the new one. Note that this doesn't affect | ||
! the calculations involving NeHomog or Coreg, as the new LUTs simply don't | ||
! support the SAD-file method of setting these values. | ||
! Bugs: | ||
! None known. | ||
!------------------------------------------------------------------------------- | ||
|
@@ -185,7 +189,7 @@ subroutine Get_Measurements(Ctrl, SAD_Chan, SPixel, MSI_Data, status) | |
do i = 1, SPixel%Ind%Ny | ||
ii = SPixel%spixel_y_to_ctrl_y_index(i) | ||
if (SAD_Chan(ii)%Thermal%Flag > 0) then | ||
if (len_trim(Ctrl%LUTClass) == 3) then | ||
if (.not. Ctrl%use_new_meas_error) then | ||
! Old LUTs approach (fixed uncertainty) | ||
! Note: NEBT is already squared when old LUT is read in. | ||
SPixel%Sy(i,i) = SAD_Chan(ii)%Thermal%NEBT | ||
|
@@ -199,16 +203,17 @@ subroutine Get_Measurements(Ctrl, SAD_Chan, SPixel, MSI_Data, status) | |
(dR_dT0(1) / dR_dTm(1))) ** 2 | ||
end if | ||
else | ||
if (len_trim(Ctrl%LUTClass) == 3) then | ||
if (.not. Ctrl%use_new_meas_error) then | ||
! Old LUTs approach (fixed uncertainty) | ||
! Note: NEDR is squared when old LUT is read in. | ||
SPixel%Sy(i,i) = SAD_Chan(ii)%Solar%NEDR | ||
else | ||
! New LUTs approach (varying uncertainty) | ||
! Convert reflectance to radiance | ||
j = SPixel%ViewIdx(i) | ||
Lx = (SPixel%Ym(i) * cos(SPixel%Geom%SolZen(j) * d2r) * & | ||
SAD_Chan(ii)%Solar%F0) / Pi | ||
!Lx = (SPixel%Ym(i) * cos(SPixel%Geom%SolZen(j) * d2r) * & | ||
! SAD_Chan(ii)%Solar%F0) / Pi | ||
Lx = (100.0 * SPixel%Ym(i) * SAD_Chan(ii)%Solar%F0) / Pi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment explaining why we're removing the \cos\theta. We won't remember next time we go to war with The Angles. |
||
! Compute uncertainty in terms of radiance | ||
if (SAD_Chan(ii)%Solar%SNR > 0.0) then | ||
if (MSI_Data%cal_gain(ii) > 0.0) then | ||
|
@@ -227,9 +232,10 @@ subroutine Get_Measurements(Ctrl, SAD_Chan, SPixel, MSI_Data, status) | |
end if | ||
! Convert radiance uncertainty to reflectance uncertainty | ||
! then square it to convert to reflectance variance | ||
SPixel%Sy(i,i) = ((Pi * dLx) / & | ||
(cos(SPixel%Geom%SolZen(j) * d2r) * & | ||
SAD_Chan(ii)%Solar%F0)) ** 2 | ||
!SPixel%Sy(i,i) = ((Pi * dLx) / & | ||
! (cos(SPixel%Geom%SolZen(j) * d2r) * & | ||
! SAD_Chan(ii)%Solar%F0)) ** 2 | ||
SPixel%Sy(i,i) = ((Pi * dLx) / (100.0 * SAD_Chan(ii)%Solar%F0)) ** 2 | ||
end if | ||
end if | ||
end do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
! grids consistent in dimension size, spacing and vertex values. | ||
! 2017/03/16, GT: Changes for single-view aerosol retrieval mode. | ||
! 2021/03/08, AP: Gather grid dimensions into LUT_Grid_t | ||
! 2023/10/10, GT: Added calculation of old NedR (solar channel noise | ||
! equivalent radiance) Read_NCDF_SAD_LUT(), to allow use of old | ||
! uncertainty calculation with new LUTs. | ||
! | ||
! Bugs: | ||
! - Arrays are allocated excessively large as dimensions of the text tables | ||
|
@@ -1225,8 +1228,12 @@ subroutine Read_NCDF_SAD_LUT(Ctrl, LUTFilename, SAD_Chan, SAD_LUT) | |
! Uncertainty = a**2 L**2 + b**2 L + c**2 | ||
call ncdf_read_array(fid, "ru"//char(j+96), chan_tmp_real) | ||
do i = 1, Ctrl%Ind%NSolar | ||
! ru values stored in LUT already squared?! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The units in the files agree with you here. I shall check what Don meant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don says the values are not squared and so they need to be here. |
||
SAD_Chan(Ctrl%Ind%YSolar(i))%Solar%ru2(j) = & | ||
chan_tmp_real(solar_indices(i)) ** 2 | ||
chan_tmp_real(solar_indices(i)) !** 2 | ||
! Ensure SNR is explicitly set to 0 (used to determine if ru2 | ||
! should be used in get_measurments) | ||
SAD_Chan(Ctrl%Ind%YSolar(i))%Solar%SNR = 0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this done on line 1198? |
||
end do | ||
end do | ||
else | ||
|
@@ -1237,6 +1244,13 @@ subroutine Read_NCDF_SAD_LUT(Ctrl, LUTFilename, SAD_Chan, SAD_LUT) | |
chan_tmp_real(solar_indices(i)) | ||
end do | ||
end if | ||
call ncdf_read_array(fid, "oldnefr", chan_tmp_real) | ||
do i = 1, Ctrl%Ind%NSolar | ||
SAD_Chan(Ctrl%Ind%YSolar(i))%Solar%NedR = & | ||
( chan_tmp_real(solar_indices(i)) / & | ||
SAD_Chan(Ctrl%Ind%YSolar(i))%Solar%F0 )**2 | ||
end do | ||
|
||
deallocate(chan_tmp_real) | ||
end if | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Should also delete them from the output_data structure.