Skip to content

Remove channels when writing to varobs (FCI setup) - #279

Draft
Owen Lewis (orlewis) wants to merge 21 commits into
developfrom
feature/varchannel_adjust
Draft

Owen Lewis (orlewis) wants to merge 21 commits into
developfrom
feature/varchannel_adjust

Conversation

@orlewis

Copy link
Copy Markdown
Contributor

For FCI, some of the channels are required to be processed but not all are required to be written out into the varobs file.

This change enables the var_channels option to be used to reduce the number of channels which are written out into the varobs file.
For example if we had channels 5,6,7,9,10,11 and we only wanted channels 5 and 10 in the varobs file then var_channels would be set to 5, 10.
Previously the code would have put channels 5 and 10 into the 5 and 6 spaces. This change will now put the channels into the correct location of 5 and 10.

This however does hijack how var_channels is intended to be used (it was always assumed that the length of channels selected would be the same as the var_channels). It does mean if the length of var_channels is less then all_channels then this cannot be used for mapping the channels to new identities at the same time.

This has been run through here https://cylchub/services/cylc-review/view/owen.lewis?&suite=sith_fci_opsinputtest%2Frun1&no_fuzzy_time=0&path=log/job/20210701T1200Z/glu_var_jopa_anal_low/22/job.stats#957

ctests have also been created.

Running through all the ctests there are failures but that looks to be due to a missing file.
https://cylchub/services/cylc-review/taskjobs?per_page=15&user=owen.lewis&no_fuzzy_time=0&suite=mobbm-opsinputs%2Frun13&task_status=expired&task_status=failed&task_status=preparing&task_status=running&task_status=submitted&task_status=submit-failed&task_status=succeeded&task_status=waiting&page=1

Github copilot was used.

@PJLevensMO

Copy link
Copy Markdown
Contributor

This looks to work for both SEVIRI and FCI in my testing so far - thanks for adding it.

To note, though, I had failures for FCI when I had the increase_chan_array varobs writer option set to true. Not sure why that was the case, but the output/error can be seen in this run: https://cylchub/services/cylc-review/view/peter.levens?&suite=fci_reducechan%2Frun9&no_fuzzy_time=0&path=log/job/20250812T1200Z/glu_jopa_process_background_fciclr/01/job.out - I can't see any obvious reason for the failure in the output. But removing that option appears to work as expected.

@PJLevensMO

Copy link
Copy Markdown
Contributor

This however does hijack how var_channels is intended to be used (it was always assumed that the length of channels selected would be the same as the var_channels). It does mean if the length of var_channels is less then all_channels then this cannot be used for mapping the channels to new identities at the same time.

I think it may be worth at least opening an issue on this point to be looked at soon-ish - just in case we ever need to pull a channel from ABI or AHI which do use the varChannels option for mapping.

@mikecooke77

Michael Cooke (mikecooke77) commented Apr 7, 2026 •

Copy link
Copy Markdown
Collaborator

I've just been discussing this with Owen and I can't figure out why this should be needed. The mapping issue looks exactly the same issue as with SEVIRI but with different numbers. If I'm understanding the varobs writer correctly you should need something like this for FCI:

filter: VarObs Writer
    reject_obs_with_all_variables_failing_qc: true
    variables_for_quality_control:
    - name: brightnessTemperature
      channels: 10, 11, 12, 14, 15, 16
    varChannels: 10, 11, 12, 14, 15, 16
    compress_var_channels: false
    size_of_varobs_array: 16

PJLevensMO could you explain why this does not work?

@PJLevensMO

Copy link
Copy Markdown
Contributor

I've just been discussing this with Owen and I can't figure out why this should be needed. The mapping issue looks exactly the same issue as with SEVIRI but with different numbers. If I'm understanding the varobs writer correctly you should need something like this for FCI:

filter: VarObs Writer
    reject_obs_with_all_variables_failing_qc: true
    variables_for_quality_control:
    - name: brightnessTemperature
      channels: 10, 11, 12, 14, 15, 16
    varChannels: 10, 11, 12, 14, 15, 16
    compress_var_channels: false
    size_of_varobs_array: 16

PJLevensMO could you explain why this does not work?

With everything the same as SEVIRI, this does work. The problem is when we want to remove channels in the QC - then the remaining channels get compressed.

This channel removal is something I'm investigating for the FCI implementation. One solution that partly works is to remove the unwanted channels from the all_channels list, but in doing that means those channels cannot be used in the QC, which we do want - e.g. channel 14 is used in undetected cloud identification but I'm looking to test removing it from assimilation. There appears to be no way currently that allows me to use a channel in QC but then not assimilate it without compressing the other channels into the wrong positions. Owen's solution here works in the way I'm looking to test.

@PJLevensMO

Copy link
Copy Markdown
Contributor

Can we open this up properly for review Owen Lewis (@orlewis) ? It is looking likely that this will be required for FCI implementation. I will be running a trial with these settings shortly (I'll create a JEDI build using this branch)

@ctgh Chris Thomas (ctgh) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks fine from my perspective. Do you need it to be merged asap?

@PJLevensMO

Copy link
Copy Markdown
Contributor

This looks fine from my perspective. Do you need it to be merged asap?

It is not absolutely urgent. I can continue testing using settings from this branch, especially as it is up to date with develop. The upcoming tests I am considering for FCI actually may negate the requirement for this change (in the global at least).

@PJLevensMO

Copy link
Copy Markdown
Contributor

Tests are still ongoing as to the best setup for FCI in operations, and it is not yet clear whether this PR is needed. I'll keep this updated as testing continues.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved channel/value mismatches, incompatible array shapes, incomplete subset handling, and invalid test parameter types block approval.

5 open issues
What changed in this PR

This PR extends the VarObs writer’s varChannels handling so FCI can process more channels than it writes, while preserving selected channel identities.

Changes:

  • Adds subset-aware channel-number allocation, population, and counting.
  • Adds smoke and checker configurations for channel subsets.
  • Registers both tests with CMake.
File Description
test/​testinput/​VarObsWriterNamelists_varobswriter_varChanneltest_checker/​SEVIRIClr.nl Selects channel-count and channel-number fields for checking.
test/​testinput/​varobswriter_varChanneltest.yaml Adds a channel-subset smoke-test configuration.
test/​testinput/​varobswriter_varChanneltest_checker.yaml Adds expected channel metadata for subset output.
test/​testinput/​varobswriter_varChanneltest Adds an extensionless copy of the smoke-test input.
test/​CMakeLists.txt Registers the new writer tests.
src/​opsinputs/​opsinputs_varobswriter_mod.F90 Implements subset handling for ChanNum and NumChans.

Review effort: Balanced

! equal to size(varChannels) and equal to size(channels)).
! When varObsSize_loc == 0 we assign ChannelIndices directly, so allocate with NumChannels
! = size(channels) so shapes always match.
if (size(varChannels) > 0 .and. size(varChannels) < size(channels) .and. varObsSize_loc /= 0) then
Comment on lines +1340 to +1342
if (size(varChannels) > 0 .and. size(varChannels) < size(channels) .and. varObsSize_loc /= 0) then
call Ops_Alloc(Ob % Header % ChanNum, "ChanNum", Ob % Header % NumObsLocal, Ob % ChanNum, &
num_levels = int(size(varChannels), kind=integer64))
Comment on lines +1414 to +1417
if (channels(ChannelIndices(iObs, iChannel)) == varChannels(array_loop)) then
if (iVarChannel < size(varChannels)) then
iVarChannel = iVarChannel + 1
ChannelIndicesVar(iObs, iVarChannel) = varChannels(array_loop)
Comment on lines +1452 to +1459
if (FillChanNum .and. associated(Ob % ChanNum) .and. &
size(varChannels) > 0 .and. size(varChannels) < size(channels) .and. varObsSize_loc /= 0) then
do iObs = 1, Ob % Header % NumObsLocal
Ob % NumChans(iObs) = count(Ob % ChanNum(iObs, :) > 0)
end do
else
Ob % NumChans = ChannelCounts
end if
- filter: VarObs Writer
namelist_directory: ../etc/global/varobs
general_mode: debug
varChannels: [1] # intentionally fewer than obs space channels (1,3)

This branch has not been deployed

No deployments
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.

5 participants