Skip to content

Update SpcCoeff_Binary_IO.f90#43

Merged
BenjaminTJohnson merged 1 commit intofeature/btj_REL-2.4.0_emc_convert_tests_to_cmakefrom
ADCollard-patch-1
Sep 19, 2023
Merged

Update SpcCoeff_Binary_IO.f90#43
BenjaminTJohnson merged 1 commit intofeature/btj_REL-2.4.0_emc_convert_tests_to_cmakefrom
ADCollard-patch-1

Conversation

@ADCollard
Copy link

Fix version numbers for read

There is a bug in SpcCoeff_Binary_IO.f90. Specifically these lines:

IF( dummy%Version > 2 ) THEN
! Binary coefficient version 3 introduced for TROPICS instrument.
! The SpcCoeff coefficients contain 'PolAngle' as an additional
! array.
READ ( fid, IOSTAT=io_stat, IOMSG=io_msg ) &
SpcCoeff%Sensor_Channel , &
SpcCoeff%Polarization , &
SpcCoeff%PolAngle , &
SpcCoeff%Channel_Flag , &
SpcCoeff%Frequency , &
SpcCoeff%Wavenumber , &
SpcCoeff%Planck_C1 , &
SpcCoeff%Planck_C2 , &
SpcCoeff%Band_C1 , &
SpcCoeff%Band_C2 , &
SpcCoeff%Cosmic_Background_Radiance, &
SpcCoeff%Solar_Irradiance
ELSE IF( dummy%Version < 3 ) THEN
! Version 2 is the default binary SpcCoeff version for
! REL-2.4.0 and older.
READ ( fid, IOSTAT=io_stat, IOMSG=io_msg ) &
SpcCoeff%Sensor_Channel , &
SpcCoeff%Polarization , &
SpcCoeff%Channel_Flag , &
SpcCoeff%Frequency , &
SpcCoeff%Wavenumber , &
SpcCoeff%Planck_C1 , &
SpcCoeff%Planck_C2 , &
SpcCoeff%Band_C1 , &
SpcCoeff%Band_C2 , &
SpcCoeff%Cosmic_Background_Radiance, &
SpcCoeff%Solar_Irradiance

Most of the versions in fix/SpcCoeff/Big_Endian are 8.02 or (for ATMS_N21) 8.04, but amsua_metop-b is version 8.03, so dummy%Version=3. This file does not contain PolAngle, which is why the code crashes.

The comment says that version 3 should include this field, so I do not know which is right. But changing dummy%Version > 2 to dummy%Version > 3 allows the file to be read in.

Also not that the IF( dummy%Version < 4 ) does not actually do anything (this will always be true).

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have run the unit tests before creating the PR

Fix version numbers for read
@BenjaminTJohnson
Copy link
Collaborator

Thanks @ADCollard ! I appreciate your help in getting this sorted. I'll test now and get back shortly.

@BenjaminTJohnson BenjaminTJohnson merged commit cd25495 into feature/btj_REL-2.4.0_emc_convert_tests_to_cmake Sep 19, 2023
@BenjaminTJohnson BenjaminTJohnson deleted the ADCollard-patch-1 branch September 19, 2023 17:27
Copy link
Author

@ADCollard ADCollard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants