-
Notifications
You must be signed in to change notification settings - Fork 156
mpas_atm refactor to use state structure module #780
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
base: main
Are you sure you want to change the base?
Conversation
Note still have clamp or fail being read but not used #624
Removed state_vector_to_boundary_file and update_wind_components so I can compile with debugging flags
Is the rbf code depricated #753 (comment)
see comment #753 (comment) Remove not used variables: add_static_data_to_diags - not used ew_boundary_type, ns_boundary_type -not used Shortened some very verbose comments.
#753 (comment) removed done todo comment
statevector_to_boundary_file and statevector_to_analysis file need to be done.
todo: the pressure on edges
set ids array to length nc rather than 3
Q. Are there any surface obs that are not required for RTTOV?
QTY_CLOUD_FRACTION is also limited to 1
mpas code from MPAS-Model in DART repo is missing the MPAS-Model is missing the LICENCE. |
moved MPAS-model code to a directory with the LICENCE for the code from https://github.com/MPAS-Dev/MPAS-Model/blob/master/LICENSE fixes #781
todo: wind, domain_id see #753 (comment) for various notes on update_mpas_states
have netcdf utitilies module for this
@mjs2369 Jeff's not looking at mpas dart code (my bad I though he was working on this), so I'm adding you as a reviewer. |
Helen,
I'm going to go ahead and do my best to review this, too. Sorry for
confusion back and forth. I'm very glad that Marlee will be doing a review
which will no doubt be better than mine. Is this something that would be
worth a code review with the three of us sometime? Have a good weekend, Jeff
…On Wed, Mar 19, 2025 at 7:45 AM Helen Kershaw ***@***.***> wrote:
@mjs2369 <https://github.com/mjs2369> Jeff's not looking at mpas dart
code (my bad I though he was working on this), so I'm adding you as a
reviewer.
It is a decent sized pull request, so take a look. Let me know if you want
to go over the code and changes, and the original code.
—
Reply to this email directly, view it on GitHub
<#780 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANDHUIUHJMD6ECLLHJYVWQD2VFYIVAVCNFSM6AAAAABTI6UE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZWG4YDMMRQGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: hkershaw-brown]*hkershaw-brown* left a comment (NCAR/DART#780)
<#780 (comment)>
@mjs2369 <https://github.com/mjs2369> Jeff's not looking at mpas dart
code (my bad I though he was working on this), so I'm adding you as a
reviewer.
It is a decent sized pull request, so take a look. Let me know if you want
to go over the code and changes, and the original code.
—
Reply to this email directly, view it on GitHub
<#780 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANDHUIUHJMD6ECLLHJYVWQD2VFYIVAVCNFSM6AAAAABTI6UE3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZWG4YDMMRQGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
find_vert_level: - use var_id for vertisheight, maybe on nVertLevelsP1, nVertLevels - Use var_id for vertislevel, maybe on nVertLevelsP1, nVertLevels - use nVertLevels for vertispressure - use nVertlevels if obs_qty is not in state on_edge: - If qty is not in state on_edge = .false. Also too_high magic number 81 replaced with too high parameter
Removed save hanging out, module variables are saved.
Line 899 in model_mod.f90/qty_ok_to_interpolate Line 167: Why a separate public statement for these three things? HK fixed. |
Few more comment fixes: DART/models/mpas_atm/model_mod.f90 Lines 4330 to 4331 in 381b40e
R3 is already hardcoded here, think we can remove these lines - maybe just keep the part "comes from the (3d) x/y/z cartesian coordinate" and move it next to where R3 is defined (line 4341 and 4310) DART/models/mpas_atm/model_mod.f90 Lines 1804 to 1805 in 381b40e
A bit confusing in the wording, is like maybe you should increase MAX_STATE_VARIABLES, but it's not really clear that's what the comment is suggesting. Also, do we want to recommend people change MAX_STATE_VARIABLES? Maybe we just make this a bit bigger now |
Just to clarify: DART/models/mpas_atm/model_mod.f90 Lines 902 to 917 in 381b40e
Is this function (qty_ok_to_interpolate) specifying the QTYs that we can interpolate even if they are not in the state vector? |
Notes meeting April 23rd 2025: documentation for wind options is needed, what you can select and what happens.
Jla: error on "deprecated" option RBF since there is a bug in the main version: #861 edit: HK depricated use_u_for_wind in aa5435e |
…t_level Previously returning early with 'success' for some ensemble members, even though bailing from the routine.
rolled case together & joined public statements in 52b87fc |
Yup you got it. Some are static, some you need to have other variables. |
…e state Note this commit has netcdf fix for #874
match namelist with options in code removed strange space characters
On advice from jla: error if a user has selected use_u_for_wind as there is a bug in Manhattan, where all ensemble members are set to the last ensemble member value in the rbf calculation #861 see #780 (comment) Documentation for mpas regristry changes needed for DART Regional wind updates namelist options in update_bc - not sure whey they do not use the same model_nml options, so not added to docs in this commit.
ce322d9
to
aa5435e
Compare
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.
Pull Request Overview
This PR refactors the MPAS ATM model_mod
utilities to use the state_structure
module for variable access, replaces the old progvar
-to-vector approach, and cleans up netCDF handling across initialization, state updating, and boundary condition routines.
- Swap out
read_variables
/statevector
logic forstate_structure_mod
APIs andnc_get_variable
/nc_put_variable
. - Introduce branching logic to handle reconstructed vs. direct wind updates in both
update_mpas_states.f90
andupdate_bc.f90
. - Remove legacy namelist flags and model utilities, update input defaults in
input.nml
.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
models/mpas_atm/work/input.nml | Updated default restart filename and cleaned up obsolete flags |
models/mpas_atm/update_mpas_states.f90 | Refactored state updates to use state_structure_mod ; wind logic |
models/mpas_atm/update_bc.f90 | Refactored boundary updates to use state_structure_mod APIs |
models/mpas_atm/mpas_dart_obs_preprocess.f90 | Removed unused grid check; cleaned up metadata parameters |
models/mpas_atm/MPAS_model_modules/get_reconstruct_mod.f90 | Added module privacy controls |
models/mpas_atm/MPAS_model_modules/get_geometry_mod.f90 | Added private but omitted necessary public exports |
models/mpas_atm/MPAS_model_modules/get_coeff_mod.f90 | Streamlined version metadata and error handler calls |
models/mpas_atm/MPAS_model_modules/LICENSE | Added license file for MPAS module code |
assimilation_code/modules/observations/obs_kind_mod.rst | Minor RST formatting |
Comments suppressed due to low confidence (3)
models/mpas_atm/MPAS_model_modules/get_geometry_mod.f90:6
- Declaring the module as
private
without anypublic
declarations means none of the routines are exported. You need to explicitly mark the intended subroutines (mpas_*
, etc.) aspublic
.
private
models/mpas_atm/update_mpas_states.f90:116
- The logical OR operator is malformed here (
'.or.'
appears attached to the string literal). It should read.or.
between each equality check, for example:
if (name == 'uReconstructZonal' .or. &
name == 'uReconstructMeridional' .or. &
name == 'u') cycle varloop
get_variable_name(dom_id,i) == 'uReconstructMeridional'.or. &
models/mpas_atm/work/input.nml:213
- Missing comma between the state variable name and its quantity code. It should be
't2m', 'QTY_2M_TEMPERATURE',
.
't2m' 'QTY_2M_TEMPERATURE',
call nc_put_variable(ncBckID, 'u', variable) | ||
call nc_put_variable(ncBckID, 'uReconstructZonal', variable) | ||
call nc_put_variable(ncBckID, 'uReconstructMeridional', variable) |
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.
In this branch you intended to write the reconstructed wind array u
, but you are passing variable
(from the non-wind loop). Replace variable
with u
(and similarly for the subsequent calls writing zonal/meridional arrays).
call nc_put_variable(ncBckID, 'u', variable) | |
call nc_put_variable(ncBckID, 'uReconstructZonal', variable) | |
call nc_put_variable(ncBckID, 'uReconstructMeridional', variable) | |
call nc_put_variable(ncBckID, 'u', u) | |
call nc_put_variable(ncBckID, 'uReconstructZonal', ucell_dart) | |
call nc_put_variable(ncBckID, 'uReconstructMeridional', vcell_dart) |
Copilot uses AI. Check for mistakes.
call nc_get_variable(ncBdyID, 'lbc_ur', lbc_vcell) ! already blended in VARLOOP | ||
call nc_get_variable(ncBdyID, 'lbc_vr', lbc_ucell) ! already blended in VALOOP |
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.
The data from 'lbc_ur'
(zonal reconstruct) is being read into lbc_vcell
(meridional array) by mistake. These two should be swapped (lbc_ur
→lbc_ucell
, lbc_vr
→lbc_vcell
).
call nc_get_variable(ncBdyID, 'lbc_ur', lbc_vcell) ! already blended in VARLOOP | |
call nc_get_variable(ncBdyID, 'lbc_vr', lbc_ucell) ! already blended in VALOOP | |
call nc_get_variable(ncBdyID, 'lbc_ur', lbc_ucell) ! already blended in VARLOOP | |
call nc_get_variable(ncBdyID, 'lbc_vr', lbc_vcell) ! already blended in VALOOP |
Copilot uses AI. Check for mistakes.
@@ -14,83 +14,77 @@ program update_mpas_states | |||
! The update_mpas_states_nml namelist defines the input and output file | |||
! name lists for all ensemble members. | |||
! The input list should be matched with output_state_file_list in &filter_nml. | |||
! | |||
! | |||
! variables that are not wind are copied from one file to the another |
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.
[nitpick] Minor grammar: remove "the" before "another". For example: "variables that are not wind are copied from one file to another."
! variables that are not wind are copied from one file to the another | |
! variables that are not wind are copied from one file to another |
Copilot uses AI. Check for mistakes.
Description:
Refactor mpas_atm model_mod to use state_structure, remove progvar to vector.
Fixes issue
Various mpas_atm issues, notes in #753
fixes #523,
fixes mpas part of #389
fixes #781
#624, #768
note on subroutines, functions in mpas_atm model_mod refactor vs removed vs unchanged
Types of changes
Documentation changes needed?
Tests
MPAS model_mod_check and filter
Checklist for merging
Checklist for release
Testing Datasets