-
Notifications
You must be signed in to change notification settings - Fork 2
Map channels to Var Channels #181
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
Merged
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
4516268
Trying combining offset with use_actual_channels
orlewis 267400b
A commit
orlewis 5fbcae4
Commit some changes
orlewis 367c588
A push for testing purposes.
orlewis 0693597
Some more changes, bu failing at call to fillchan
orlewis 9160d8f
Strip out the offset channels and use_actual_channels.
orlewis 7f6eb8b
This is an example of a setup which works. I think the Ob % ChanNum =…
orlewis 3b70b72
This is the setup that I think is required but this crashes at line 1…
orlewis d7281c6
Change output dir to mine (plevens) and remove / at end of output_dir…
PJLevensMO 6c94212
Change path of another file to my own directory due to permission pro…
PJLevensMO 4f4cb4d
remove output_directory line
PJLevensMO 475552c
Change to CallSign in yaml
PJLevensMO 76eda7f
Change to fields in yaml
PJLevensMO d1dcd48
Changes to lat, lon, and time for ctest
PJLevensMO fb14ab9
Change level field in ctest yaml
PJLevensMO 1ec327b
Update ob value field in ctest yaml
PJLevensMO 3d968eb
Merge branch 'develop' into feature/map_chans
PJLevensMO ff5a6b5
Add size_of_varobs_array back to opsinputs_varobswriter_mod.f90 and a…
PJLevensMO 8db38c3
This is a bit messy and may need to be reverted but handy to see what…
orlewis 3474b2d
A por version which has just reintroduced previous options under new …
orlewis 612f81d
All the ctests are now passing.
orlewis 6cf78b2
Change to the logic to work for var channels not compressed.
orlewis 585cdf5
Creating an option to increase the size of the channel array to the s…
orlewis 0f69bcf
Merge branch 'develop' into feature/map_chans
orlewis 604247d
remove some of the write statements
orlewis ecc201d
Merge branch 'develop' into feature/map_chans
orlewis 6de28db
Some tidy up, removing write statements etc.
orlewis 9c78b00
Merge branch 'feature/map_chans' of https://github.com/MetOffice/opsi…
orlewis c1d6ab6
Removing outdated comments
orlewis 61daafd
Restore develop versions, nothing should have changed with these files.
orlewis f0745a1
Adding local variables to handle optional better. Dealing with review…
orlewis e69c9e5
Remove own drietories and correct typo
orlewis 61c2116
re include emissivity
orlewis 4a7ff45
Missed brackets off if statement
orlewis 178c036
Fix missing brackets for if statements, remove extra variables from t…
orlewis 5ed1762
MCC changes
mikecooke77 fa689d4
Merge branch 'feature/map_chans' of https://github.com/MetOffice/opsi…
mikecooke77 c6c03ec
Switch compress_var_channels to be default true
orlewis f3f53ea
Fix if statement logic
orlewis be8274c
More changes to the if logic so that the ctests pass.
orlewis a195cca
Merge branch 'feature/map_chans' of https://github.com/MetOffice/opsi…
orlewis ca33a65
Remove merge issues
orlewis 7dd1b1a
Return emissivity setting to original.
orlewis 5850350
Merge branch 'feature/map_chans' of https://github.com/MetOffice/opsi…
mikecooke77 2a88f13
empty commit
orlewis e4bdc7f
Merge branch 'feature/map_chans' of https://github.com/MetOffice/opsi…
mikecooke77 dc0419b
Merge branch 'develop' into feature/map_chans
mikecooke77 0578f73
Another edit to the if statement logic.
orlewis dd10238
Merge branch 'feature/map_chans' of https://github.com/MetOffice/opsi…
mikecooke77 4f60601
Improve logic
mikecooke77 a50c5c1
Merge branch 'develop' into feature/map_chans
orlewis f31875a
Merge branch 'feature/map_chans_simplify_logic' into feature/map_chans
orlewis 197a18a
Update descriptions for new options.
orlewis 334b696
Change sizeVarObs to sizeOfVarobsArray
orlewis c6f17ed
Remove the emissivity part from https://rom-saf.eumetsat.int/romsaf_r…
orlewis fbeb883
Update to use IMDI
orlewis 4d07e90
Merge branch 'develop' into feature/map_chans
orlewis 04fc0b5
Merge branch 'develop' into feature/map_chans
mikecooke77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1030,12 +1030,19 @@ end subroutine opsinputs_fill_fillreal | |
| !> of variables with suffixes corresponding to the indices specified in \p Channels. | ||
| !> \param[in] JediGroup | ||
| !> Group of the JEDI variable used to populate \p Real2. | ||
| !> \param[in] compressVarChannels | ||
| !> Whether to apply var channel compression (No NaN spaces between channels) | ||
| !> \param[in] sizeOfVarobsArray | ||
| !> The size of the varobs array which the output data will be stored in. | ||
| !> \param[in] varChannels | ||
| !> A list of the var channel numbers which the channels will be mapped to. | ||
| !> | ||
| !> \note This function returns early (without a warning) if the specified JEDI variable is not found. | ||
| !> We rely on warnings printed by the OPS code whenever data needed to output a requested varfield | ||
| !> are not found. | ||
| subroutine opsinputs_fill_fillreal2d_norecords( & | ||
| Hdr, OpsVarName, NumObs, Real2, ObsSpace, Channels, JediVarName, JediVarGroup, OffsetChans, useActualChans) | ||
| Hdr, OpsVarName, NumObs, Real2, ObsSpace, Channels, JediVarName, & | ||
| JediVarGroup, compressVarChannels, sizeOfVarobsArray, varChannels) | ||
| implicit none | ||
|
|
||
| ! Subroutine arguments: | ||
|
|
@@ -1047,8 +1054,10 @@ subroutine opsinputs_fill_fillreal2d_norecords( & | |
| integer(c_int), intent(in) :: Channels(:) | ||
| character(len=*), intent(in) :: JediVarName | ||
| character(len=*), intent(in) :: JediVarGroup | ||
| type(opsinputs_channeloffset), optional, intent(in) :: OffsetChans | ||
| logical, optional, intent(in) :: useActualChans | ||
| logical, optional, intent(in) :: compressVarChannels | ||
| integer(integer64), optional, intent(in) :: sizeOfVarobsArray | ||
| integer(c_int), optional, intent(in) :: varChannels(:) | ||
|
|
||
|
|
||
| ! Local declarations: | ||
| real(kind=c_double) :: VarValue(NumObs) | ||
|
|
@@ -1057,52 +1066,77 @@ subroutine opsinputs_fill_fillreal2d_norecords( & | |
| integer :: iChannel | ||
| integer :: offset | ||
| integer :: numchans | ||
| logical :: localUseActualChans | ||
| integer :: offsetsize | ||
| integer :: arrayindex | ||
| logical :: compressChannels | ||
|
|
||
| ! Body: | ||
|
|
||
| MissingDouble = missing_value(0.0_c_double) | ||
|
|
||
| compressChannels = .true. | ||
| if (present(compressVarChannels)) then | ||
| compressChannels = compressVarChannels | ||
| end if | ||
|
|
||
| JediVarNamesWithChannels = opsinputs_fill_varnames_with_channels(JediVarName, Channels) | ||
|
|
||
| !take into account offsetting of 2nd dimension if required | ||
| !designed to be used to pack where multiple satellite instruments expected | ||
| !e.g. HIRS in ATOVS stream | ||
| offset = 0 | ||
| numchans = size(JediVarNamesWithChannels) | ||
| if (present(OffsetChans)) then | ||
| offset = OffsetChans % channel_offset | ||
| if (OffsetChans % size_of_varobs_array > 0) & | ||
| numchans = OffsetChans % size_of_varobs_array | ||
| end if | ||
|
|
||
| !Setup for channels needing to match array index | ||
| localUseActualChans = .false. | ||
| if (present(useActualChans)) then | ||
| localUseActualChans = useActualChans | ||
| numchans = size(JediVarNamesWithChannels) | ||
| !sizeOfVarobsArray comes from intitial setting of size_of_varobs_array | ||
| ! used to define the size of the channel array to fill. | ||
| if (present(sizeOfVarobsArray)) then | ||
| if (sizeOfVarobsArray > 0) then | ||
| numchans = sizeOfVarobsArray | ||
| end if | ||
| end if | ||
|
|
||
| if (obsspace_has(ObsSpace, JediVarGroup, JediVarNamesWithChannels(1))) then | ||
| ! Allocate OPS data structures | ||
| call Ops_Alloc(Hdr, OpsVarName, NumObs, Real2, & | ||
| num_levels = int(numchans, kind=integer64)) | ||
| do iChannel = 1, size(JediVarNamesWithChannels) | ||
| ! Retrieve data from JEDI | ||
| call obsspace_get_db(ObsSpace, JediVarGroup, JediVarNamesWithChannels(iChannel), VarValue) | ||
|
|
||
| ! Fill the OPS data structures | ||
| if (localUseActualChans) then | ||
| where (VarValue /= MissingDouble) | ||
| Real2(:, Channels(iChannel)) = VarValue | ||
| end where | ||
| arrayindex = iChannel | ||
|
|
||
| ! if VAR channels have been assigned then jopa channels will be mapped to these var channels | ||
| ! Set up the size of the array, if channels are being pushed together an offset between | ||
| ! the var and jopa channel numbers is added onto the size of the array. | ||
| ! If not compressed the positions in the array are based on the actual channel number. | ||
|
|
||
| if (present(varChannels)) then | ||
|
Collaborator
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. I think a comment is needed to explain what is happening in this new section. |
||
| if (size(varChannels) > 0) then | ||
| if (iChannel <= size(varChannels)) then | ||
| if (compressChannels) then | ||
| offsetsize = abs(varChannels(1) - channels(1)) | ||
|
james-cotton marked this conversation as resolved.
|
||
| arrayindex = arrayindex + offsetsize | ||
| else | ||
| arrayindex = varChannels(iChannel) | ||
| end if | ||
| end if | ||
| else | ||
| if (.not. compressChannels) then | ||
| arrayindex = Channels(iChannel) | ||
| end if | ||
| end if | ||
| else | ||
| ! Fill the OPS data structures | ||
| where (VarValue /= MissingDouble) | ||
| Real2(:, iChannel+offset) = VarValue | ||
| end where | ||
| if (present(sizeOfVarobsArray)) then | ||
| if (sizeOfVarobsArray > size(channels)) then | ||
| if (.not. compressChannels) then | ||
| arrayindex = Channels(iChannel) | ||
| end if | ||
| end if | ||
| end if ! the end | ||
| end if | ||
| where (VarValue /= MissingDouble) | ||
| Real2(:, arrayindex) = VarValue | ||
| end where | ||
| end do | ||
| end if ! Data not present? OPS will produce a warning -- we don't need to duplicate it. | ||
|
|
||
| end subroutine opsinputs_fill_fillreal2d_norecords | ||
|
|
||
| ! ------------------------------------------------------------------------------ | ||
|
|
@@ -1223,8 +1257,8 @@ end subroutine opsinputs_fill_fillreal2d_records | |
| !> We rely on warnings printed by the OPS code whenever data needed to output a requested varfield | ||
| !> are not found. | ||
| subroutine opsinputs_fill_fillreal2d( & | ||
| Hdr, OpsVarName, JediToOpsLayoutMapping, Real2, ObsSpace, Channels, VarobsLength, JediVarName, JediVarGroup, OffsetChans, & | ||
| useActualChans) | ||
| Hdr, OpsVarName, JediToOpsLayoutMapping, Real2, ObsSpace, Channels, & | ||
| VarobsLength, JediVarName, JediVarGroup, compressVarChannels, sizeOfVarobsArray, varChannels) | ||
| implicit none | ||
|
|
||
| ! Subroutine arguments: | ||
|
|
@@ -1237,28 +1271,44 @@ subroutine opsinputs_fill_fillreal2d( & | |
| integer(integer64), intent(in) :: VarobsLength | ||
| character(len=*), intent(in) :: JediVarName | ||
| character(len=*), intent(in) :: JediVarGroup | ||
| type(opsinputs_channeloffset), optional, intent(in) :: OffsetChans | ||
| logical, optional, intent(in) :: useActualChans | ||
| logical, optional, intent(in) :: compressVarChannels | ||
| integer(integer64), optional, intent(in) :: sizeOfVarobsArray | ||
| integer(c_int), optional, intent(in) :: varChannels(:) | ||
|
|
||
| ! local variables | ||
| logical :: compressChannels | ||
| integer(integer64) :: sizeOfVarobsArray_local | ||
| integer(c_int), allocatable :: localvarChannels(:) | ||
|
|
||
| ! Body: | ||
|
|
||
| compressChannels = .true. | ||
| if (present(compressVarChannels)) then | ||
| compressChannels = compressVarChannels | ||
| end if | ||
|
|
||
| if (present(varChannels)) then | ||
| allocate(localvarChannels(size(varChannels))) | ||
| localvarChannels = varChannels | ||
| end if | ||
|
|
||
| sizeOfVarobsArray_local = 0 | ||
| if (present(sizeOfVarobsArray)) then | ||
| sizeOfVarobsArray_local = sizeOfVarobsArray | ||
| end if | ||
|
|
||
| if (JediToOpsLayoutMapping % ConvertRecordsToMultilevelObs) then | ||
| call opsinputs_fill_fillreal2d_records( & | ||
| Hdr, OpsVarName, JediToOpsLayoutMapping, Real2, ObsSpace, VarobsLength, JediVarName, JediVarGroup) | ||
| else | ||
| if (Present(OffsetChans)) then | ||
| if (Present(useActualChans)) then | ||
| call opsinputs_fill_fillreal2d_norecords( & | ||
| Hdr, OpsVarName, JediToOpsLayoutMapping % NumOpsObs, Real2, ObsSpace, Channels, & | ||
| JediVarName, JediVarGroup, OffsetChans, useActualChans) | ||
| else | ||
| call opsinputs_fill_fillreal2d_norecords( & | ||
| Hdr, OpsVarName, JediToOpsLayoutMapping % NumOpsObs, Real2, ObsSpace, Channels, & | ||
| JediVarName, JediVarGroup, OffsetChans) | ||
| end if | ||
| if (allocated(localvarChannels)) then | ||
| call opsinputs_fill_fillreal2d_norecords( & | ||
| Hdr, OpsVarName, JediToOpsLayoutMapping % NumOpsObs, Real2, ObsSpace, Channels, & | ||
| JediVarName, JediVarGroup, compressChannels, sizeOfVarobsArray_local, varChannels) | ||
| else | ||
| call opsinputs_fill_fillreal2d_norecords( & | ||
| Hdr, OpsVarName, JediToOpsLayoutMapping % NumOpsObs, Real2, ObsSpace, Channels, & | ||
| JediVarName, JediVarGroup) | ||
| JediVarName, JediVarGroup, compressChannels, sizeOfVarobsArray_local) | ||
| end if | ||
| end if | ||
|
|
||
|
|
@@ -2386,6 +2436,7 @@ function opsinputs_fill_varnames_with_channels(VarName, Channels) result(VarName | |
| write (VarNames(ichan),'(A,"_",I0)') VarName, Channels(ichan) | ||
| end do | ||
| end if | ||
|
|
||
| end function opsinputs_fill_varnames_with_channels | ||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Worth adding a comment here?