Skip to content

bugfix: Replace non-standard fstat with standard Fortran INQUIRE in mkMITAquaRaster.F90 - #1446

Merged
mathomp4 merged 3 commits into
developfrom
bugfix/fixes-for-gcc16-8002ecf1
Jun 11, 2026
Merged

mathomp4 merged 3 commits into
developfrom
bugfix/fixes-for-gcc16-8002ecf1

Conversation

@mathomp4

@mathomp4 mathomp4 commented Jun 4, 2026 •

Copy link
Copy Markdown
Member

NOTE

I had to close #1445 and reopen this PR with a different branch name. Something very weird was happening with CI/mepo.


GCC 16 tightened enforcement of the fstat intrinsic signature, requiring a 13-element array but the code declared only 12, causing a compile error:

Error: Size of 'values' argument of 'fstat' intrinsic at (1) too small (12/13)

fstat is a non-standard GNU extension. This fix replaces both calls with the standard Fortran 2003 INQUIRE(file=..., size=...) intrinsic, which directly returns the file size without needing an intermediate status array. This is portable across compilers and was already applied in the Flang fixes in #1175.

Additional cleanup:

  • integer(REAL64) → integer(INT64) for filesize and Length — using REAL64 as a kind parameter for an integer variable was technically accidental (both happen to be kind=8 on most platforms); INT64 is semantically correct.
  • STATARRAY(12) declaration removed as it is no longer needed.
  • INT64 added to the iso_fortran_env import.

All my testing shows this is zero-diff but then, the model doesn't run this code. This is part of the makebcs code...

(Replaces #1445, which was closed due to a branch rename to avoid a CI issue with mepo checkout-if-exists.)

@mathomp4
mathomp4 requested a review from a team as a code owner June 4, 2026 20:12
@mathomp4 mathomp4 added the 0 diff The changes in this pull request have verified to be zero-diff with the target branch. label Jun 4, 2026
sdrabenh
sdrabenh previously approved these changes Jun 4, 2026
@mathomp4
mathomp4 requested review from atrayano and removed request for biljanaorescanin and gmao-rreichle June 10, 2026 13:06

@biljanaorescanin biljanaorescanin left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NOTE: make_bcs.py doesn't create MIT grid as part of package.

@atrayano
atrayano dismissed stale reviews from biljanaorescanin and sdrabenh via bd3701c June 10, 2026 14:24
@mathomp4
mathomp4 requested a review from sdrabenh June 11, 2026 13:39
@mathomp4
mathomp4 merged commit 104017a into develop Jun 11, 2026
15 checks passed
@mathomp4
mathomp4 deleted the bugfix/fixes-for-gcc16-8002ecf1 branch June 11, 2026 18:48
pchakraborty added a commit that referenced this pull request Jun 18, 2026
…uite (#1459)

* update readme again

* add to readme and move

* move utils_topo dir to new location

* add cmake file

* add dir to build

* we don't need all this

* Fixes #1069. Clean up WW3 Cmake

* Preserve backward compatibility for PEATMAP handling

* missed commit declaration

* change preproc to produce river_input.nc exactly used in the restarts

* using v13 for this coupled grids bathymetry update

* fix for easy

* right topo version

* better info message

* smarter cleanup

* change paths in the scripts to the updated locations for preproc input

* change path in mk_runofftbl.F90 to the new location of outlets mk_bcs inputs

* change path to new make_bcs input for make_bcs_shared.py and pfaf_frac.F90

* rename TILE2PFAF_FILE

* rename TILE2PFAF_FILE in mkEASETilesParam.F90

* code simplification / cleanup

* revert soil properties to HWSDv1.2

* edit text for v15

* minor updates to comments and white space (make_bcs_questionary.py, make_bcs_shared.py, rmTinyCatchParaMod.F90)

* cleanup: edited comments and improved readability (GEOS_LandGridComp.F90, GEOS_SurfaceGridComp.rc, preproc/routing_model/constant.f90preproc/routing_model/constant.f90)

* cleanup: removed obsolete code; improved documentation; white-space changes for improved readability (GEOS_RouteGridComp.F90)

* changed RUNOFF_IN local variable name to clarify m3/s units (GEOS_RouteGridComp.F90)

* additional edits to comments; moved allocate statement into group of similar statements (GEOS_RouteGridComp.F90)

* edited comments; clarified units; renamed variable for clarity (Qout -> Q_riv_out); replaced if/else block with select case block (reservoir.F90)

* edited comments; improved vertical alignment for readability; restricted use of MAPL module (routing_model.F90)

* further changes as in previous commit (routing_model.F90)

* fixed comments; improved vertical alignment for readability (pfaf_frac.F90)

* address Rolf's comments except pars movements to preproc and pfaf_frac.F90

* area_global_rectilinear_grid(lat, lon, rearth=6371.22) to area_global_rectilinear_grid(lat, lon, rearth=6371.) to be consistent with MAPL_RADIUS = 6371.0E3

* additional cleanup of routing model code:
- moved initializatio of Q_RES (GEOS_RouteGridComp.F90, reservoir.F90)
- renamed "number of" variables for clarity (EASE_pfaf_frac.F90)
- clarified *local* "stream" in comments
- edited comments
- white-space changes for improved vertical alignment

* change EASE_pfaf_frac.F90 to read til file and MAPL_radius used in get_river_length.f90

* added comments; changed variable name for accuracy (tid -> pfaf_ind) (EASE_pfaf_frac.F90)

* cleanup CMakeLists.txt

* cleanup. added EASE_find_subs subroutine

* routing and reservoir alpha goes to preprocessing

* remove read write tilenc4 subroutines which have been moved to MAPL

* add latlon gridcell area calculation

* calculate area on the fly

* added comment re. hard-coded values of PI and Earth radius (generate_scrip_cube.F90)

* fixing syntax error in previous commit (generate_scrip_cube.F90)

* change formula to calculate lat-lon cell

* further cleanup cellarea

* read lati_tile loni_tile from til file in EASE_pfaf_frac.F90 and some clean ups

* clean up in routing_model preproc

* using MAPL_ease_convert to get idx, jdx in the EASE_pfaf_subareaMod, also change variable pfaf_frac to subtile_area in the *_tile2pfaf.nc4 file

* clarified comments about tile space in GEOS_RouteGridComp.F90

* cleaned up LONG_NAME attributes of routing internals and exports (GEOS_RouteGridComp.F90, create_river_input.py)

* added clarifying comment (mkEASETilesParam.F90)

* fixed "if" condition for reservoir model and initialization of QRES_OUT'; added comments (GEOS_RouteGridComp.F90)

* edited comments (reservoir.F90)

* commented out obsolete function and subroutine related to mk_restarts; moved mk_RouteRestarts.F90 to dir of obsolete files (routing_model.F90, CMakeLists.txt, mk_RouteRestarts.F90)

* white-space changes to improve readability (routing_model.F90)

* edited/added comments; deleted obsolete variables; cleanup (EASE_pfaf_subarea.F90)

* corrected file name in documentation (Utils/Raster/preproc/routing_model/readme.txt)

* removed obsolete subroutine SEARCH_DNST from "public" list to fix build error from earlier commit (routing_model.F90)

* added comments; changed variable name for clarity (EASE_pfaf_subarea.F90)

* subtract lake and landice area from catchment area

* Addressed comments from Rolf

* add more explanations in the EASE_pfaf_subarea.F90

* create EASE and Pafsetter tile file

* new mkEASERaster.F90 to follow convention

* add missing file

* reading new route tile file instead of tile2pfaf.nc4 in GEOS_RouteGridComp.F90

* change the format for tile -Pfafsetter file

* correct typo

* edited comments in subroutine soil_para_hwsd() of mod_process_hres_data.F90

* Refine strict GPA22 peat classification and donor repair handling

* fixed machine-precision issue for GPA22 (GPM20) peat processing; edited comments; white-space changes (mod_process_hres_data.F90, rmTinyCatchParaMod.F90)

* fixed precision issue for GPA22 peat processing (mod_process_hres_data.F90)

* fixed syntax error in previous commit (mod_process_hres_data.F90)

* Align strict GPA22 profile peat logic with top-layer peat support

* change name option from hwsd_c to hwsd_v2

* change name option from hwsd_v2 to hwsdv2

* Remove unnecessary bcs_version normalization and fix script_template.formats

* typo

* read nc4 type til files in routing model

* fix typo v12 not v13

* update documentation for peat processing (create_README.csh)

* update documentation for peat processing (make_bcs_questionary.py)

* update documentation for peat processing (mkCatchParam.F90)

* revise processing for Global Peatland Map 2.0 (rmTinyCatchParaMod.F90, mod_process_hres_data.F90)

* fix OMP error in previous commit (mod_process_hres_data.F90)

* ci: add GitHub issue templates for MAPL3 readiness work

Add four issue templates under .github/ISSUE_TEMPLATE/ to support
the structured MAPL3 readiness campaign:

- type1_acg_migration.md    — migrate component to mapl_acg
- type2_pre_migration_audit.md — pre-migration read-and-report audit
- type3_pre_migration_fix.md   — fix a specific finding from an audit
- type4_mapl3_migration.md     — late-phase MAPL3 API migration

Templates include labels, checklists, and linking conventions consistent
with the project taxonomy defined in the planning/ directory.

* fixed logic bug in previous commit; consistency across PEAT_INFO if > and >= conditions (mod_process_hres_data.F90, rmTinyCatchParaMod.F90)

* updated documentation about PEATCLSM (catch_constants.f90)

* tweak soil parameter processing for PEAT_INFO=2 (Global Peatland Map 2.0) (mod_process_hres_data.F90)

* fixed OpenMP bug in previous commits for PEAT_INFO=2 (Global Peatland Map 2.0) (mod_process_hres_data.F90)

* add missing no-data-check for PEAT_INFO=2 processing (mod_process_hres_data.F90)

* edited LONG_NAME attributes of discharge exports (GEOS_RouteGridComp.F90)

* renamed read_ncfile_helper.F90 to river_ncfile_helper.F90 for consistency with module name and to avoid generic file name

* addressed more comments from Rolf and Weiyuan

* clean up definition of pi in topo preproc script (generate_scrip_cube.F90)

* changed module names "routing_model" and "outlets" to avoid name conflict and for consistency with F90 file names (./Raster/preproc/outlets/*.f90, ./Raster/preproc/routing_model/*.f90)

* fixed file name in Utils/Raster/preproc/outlets/CMakeLists.txt (after file name was change in previous commit)

* restored old, distinct values of pi in atm topo preproc (generate_scrip_cube.F90)

* added a 2nd initialize phase for CICEPlug to avoid initialization in thermo callback

* added a 2nd initialize phase for CICEPlug to avoid initialization in thermo callback

* v11: Fix bug in Turb GC

* change get_num_sub_catchment.f90 to read EASE Pfaf til file, and change to use SMAPL4_NRv11p4_runoff_mean_1990_2023.nc in clmt flow calculation

* Revert height dependence of wentr_rad in Lock to v11 approach

* runoff climatology source was changed from M36 to M09 SMAP L4 NRv11.4

* assert route_dt

* Do not repeat reading tile_file

* fix cdo on GCMv11 topo develop

* Add peat and crop preprocessing scripts for 30-arcsec

* change gpa22 to gpm 2.0 for all except files

* Adds import of DQLDTTRB and DQIDTTRB to Moist, new source for MG3. Also adjusts length scale for WC deceleration in EDMF.

* Bugfix: added terminate import to PhysGC

* using info from locstream instead of reading from tile_file

* tentatively changed makebcs peatland processing for GPM 2.0: added "peat in soil mosaic" and crop screening (mod_process_hres_data.F90)

* added missing deallocate(); edited peat-related comments (mod_process_hres_data.F90)

* For routing, changed default file name for EASE tile2pfaf info from "route_tile.nc4" to "EASE_tile2pfaf.nc4"; added documentation (GEOS_RouteGridComp.F90)

* updated documentation about peat processing (mod_process_hres_data.F90, build_gpa22_peat_rasters_30arcsec.py)

* removed unnecessary variables and added documentation in subroutine create_mapping_handler() (GEOS_RouteGridComp.F90)

* revised name of "EASE_PFAF_FILE" config variable (GEOS_RouteGridComp.F90)

* fixed path and name of EASE_PFAF_TILE_FILE in routing preprocessing routine (run_routing_preproc.py)

* Fixes various bugs/issues in Moist and Turbulence

* changed bcs version number associated with revised GPM 2.0 peat processing to "v14" (make_bcs_questionary.py, catch_constants.f90, rmTinyCatchParaMod.F90)

* removed old and unused bcs versions from options menu in make_bcs questionnaire; added documentation about "mean land elevation fix" (make_bcs_questionary.py)

* using nf90_* to read vars in EASE_pfaf_tile_file

* improved documentation of HWSD[x] and peat processing (catch_constants.f90, mod_process_hres_data.F90, rmTinyCatchParaMod.F90)

* Update peat preprocessing inputs and converter doc

* change file name

* remove file we won't use

* fix broken script due to message

* [DSL] Moist physics: UW, GFDL_1M and GF2020 (#1231)

* [DSL] remove unused constant NMODES

The constant and the associated field type are not used (anymore) in
pyMoist.

* Add GEOSldas to CI build (#1181)

Co-authored-by: Scott Rabenhorst <53346946+sdrabenh@users.noreply.github.com>

* minimal zero-diff for L72 merge from latest v12-SFE26 code

* update paths and fix make_bcs_shared topo use

* Modify comments and update route parameters file path (make_bcs_shared.py)

This change is not related to peat or HWSD, but we stick it in here because the route PR was just merged.

* v11: Make DSL internals RestartSkip (#1397)

Co-authored-by: Scott Rabenhorst <53346946+sdrabenh@users.noreply.github.com>

* add TOPO_version_info

* create route dir

* critical: addresses aggressive graupel accretion of cloud water

* corrections to limiters for graupel accretion

* updated RHCRIT parameters based on SCM results

* workaround GNU bug to vectorize powf

* ZERO_DIFF_AUTOCONV disabled for non-L72 GF configs

* fixed the zero export bug for (S/L)WNDSRF in GEOS_SeaiceInterfaceGridComp

* fixed export

* fix EASE index for EASE pfaf nc4 file

* change the indexes in ocean too

* fix codes to use the new indexing

* Fix timer issue

* build routing_model.F90 with O2 in GNU

* More missed from merge

* remove pole tiles

* Adjust yi_tile calculation for sub-catchment indexing

suggested by Yujin

* correct ease_lat_max

* remove temp = runoff(:, nlat:1:-1) in get_Qr_clmt.f90

* Remove unused variable 'temp' from get_Qr_clmt.f90

* To match the default values of SS_FOUND in ImportSpec from OpenWater and SeaiceInterface

* add python for plotting and update readme

* compile python remove idl

* Match SS_FOUND default value with OpenWater and SeaiceInterface

* Update CI - 2026-Jun-04

* bugfix: Replace non-standard fstat with standard Fortran INQUIRE in mkMITAquaRaster.F90 (#1446)

Co-authored-by: Atanas L.  Trayanov <atrayano@gs6101-bucy.gsfc.nasa.gov>

* update climatology plot and movie colorbars

* Remove legacy IDL CLSM plotting script

* Some formatting

* GWD: update component add standalone regression test suite

GEOS_GwdGridComp.F90
- Rename SetServices → GWD_SetServices to avoid symbol collision in
  the global namespace when the component is loaded as a DSO
- Replace commented-out legacy MAPL_TimerOn/Off calls with active
  MAPL_GridCompTimerStart/Stop calls (gwd_driver, gw_intr_ncar);
  add required use statements (MAPL_GridCompTimerStart/Stop, MAPL_ClockGet)
- Replace ESMF_ClockGet + ESMF_TimeIntervalGet(S_R8=DT_R8) with
  MAPL_ClockGet(dt=DT); remove now-unused DT_R8 and num_threads locals
- Uncomment #if 1 / #else / #endif preprocessor block in global-mean
  diagnostics helper

Regression test infrastructure
- Add regression/ subdirectory with CMakeLists.txt that syncs test data
  from S3 via esma_sync_data and registers each case as a CTest REGRESSION
  test run via cmake -P run_case.cmake
- Add run_case.cmake with helpers: copy_restarts, copy_file, run_geos,
  compare_results; runs GEOS.x and does byte-exact nc output comparison
  against S3-sourced baseline checkpoints
- Add first test case gwd-ncar-sa: single-step standalone NCAR GWD run on
  a C48 cubed-sphere, 72 levels, 6 MPI ranks (cap.yaml, gwd.yaml,
  cap_restart.yaml, cases.txt)
- Hook regression/ into GEOSgwd_GridComp/CMakeLists.txt via
  add_subdirectory

* GWD_StateSpecs.rc: remove SKIP from RESTART col for import fields

- Remove SKIP from the RESTART column for import fields (PLE, T, Q, U, V,
  PHIS, PREF); these fields need to be read from an import restart file
  for testing purposes

* feat(GWD): add DataGwdImports data component to gwd-ncar-sa regression test

Restructure the gwd-ncar-sa test to supply GWD imports via a dedicated
configurable_gridcomp (DataGwdImports) loaded from restart, rather than
activating all imports directly on the GWD component.

Changes:
- GWD_StateSpecs.rc: mark PLE, T, Q, U, V, PHIS, and PREF imports as
  RESTART=SKIP; their data now comes exclusively through connections
- GEOS_GwdGridComp.F90: add phase_name="run" to Run entry point
  registration; minor comment formatting cleanup
- gwd.yaml: remove geometry (moved to root), remove activate_all_imports
  and restart:import (now handled by DataGwdImports)
- root.yaml (new): configurable_gridcomp wrapper hosting GWD and
  DataGwdImports as children, owns the geometry definition, and wires
  all DataGwdImports internal fields to GWD imports via connections
- data-gwd-imports.yaml (new): configurable_gridcomp declaring all 14
  GWD import fields as internal state loaded from restart; PREF uses the
  new dims: z key to declare a vertical-only field
- cap.yaml: update root_name GWD -> Root; point cap child at root.yaml

* refactor(GWD): use _SET/_GET_NAMED_PRIVATE_STATE macros for private state

Replace the manual ESMF wrap/internal-state pattern with the MAPL
private state macros, consistent with the DynCore pattern.

- Remove the hand-rolled `wrap_` type
- Add `PRIVATE_STATE = "GWD_PRIVATE_STATE"` module-level parameter
- Add `MAPL_UserCompSetInternalState, MAPL_UserCompGetInternalState`
  to use-statement (required by the macros)
- Replace `allocate(self)` + `ESMF_UserCompSetInternalState` in
  SetServices with `_SET_NAMED_PRIVATE_STATE` + `_GET_NAMED_PRIVATE_STATE`
- Replace `ESMF_UserCompGetInternalState` + `self => wrap%PTR` in
  Initialize and Run with `_GET_NAMED_PRIVATE_STATE`

---------

Co-authored-by: Biljana Orescanin <68251545+biljanaorescanin@users.noreply.github.com>
Co-authored-by: biljanaorescanin <biljana.orescanin@nasa.gov>
Co-authored-by: Matthew Thompson <matthew.thompson@nasa.gov>
Co-authored-by: Sina Khani <sina.khani@nasa.gov>
Co-authored-by: Yujin Zeng <Yujin.Zeng@noaa.gov>
Co-authored-by: Weiyuan Jiang <weiyuan.jiang@nasa.gov>
Co-authored-by: Rolf Reichle <rolf.reichle@nasa.gov>
Co-authored-by: Rolf Reichle <54944691+gmao-rreichle@users.noreply.github.com>
Co-authored-by: Tom Clune <thomas.l.clune@nasa.gov>
Co-authored-by: bzhao <Bin.Zhao@nasa.gov>
Co-authored-by: Scott Rabenhorst <53346946+sdrabenh@users.noreply.github.com>
Co-authored-by: Nathan Arnold <nathan.arnold@nasa.gov>
Co-authored-by: Florian Deconinck <deconinck.florian@gmail.com>
Co-authored-by: Roman Cattaneo <romanc@users.noreply.github.com>
Co-authored-by: William Putman <William.M.Putman@nasa.gov>
Co-authored-by: Scott Rabenhorst <scott.d.rabenhorst@nasa.gov>
Co-authored-by: Weiyuan Jiang <52509753+weiyuan-jiang@users.noreply.github.com>
Co-authored-by: Atanas L.  Trayanov <atrayano@gs6101-bucy.gsfc.nasa.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 diff The changes in this pull request have verified to be zero-diff with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants