Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
8c4e376
set float
mkarim-rtx Jul 2, 2024
4ffd5e1
get_float
mkarim-rtx Jul 2, 2024
1dbf615
parameter type
mkarim-rtx Jul 2, 2024
36468e5
parameter item size
mkarim-rtx Jul 2, 2024
9c80bc6
adc
mkarim-rtx Jul 16, 2024
765614a
update
mkarim-rtx Jul 17, 2024
23765c8
unit test for parameters
mkarim-rtx Jul 18, 2024
e35249c
update
mkarim-rtx Jul 23, 2024
a13f9a5
running multiple catchments
mkarim-rtx Aug 19, 2024
45a61fe
Merge branch 'mkarim-NGWPC-2220' into 'development'
mkarim-rtx Aug 22, 2024
0f41b24
update
mkarim-rtx Aug 24, 2024
ffa1cdb
Merge branch 'NGWPC_3711_mkarim' into 'development'
mkarim-rtx Aug 27, 2024
742dae1
Merge branch 'release-candidate' into 'master'
shanti99surapaneni Oct 31, 2024
3a1528f
Ngwpc 3711 mkarim
mkarim-rtx Nov 5, 2024
47fb5e9
Merge branch 'NGWPC_3711_mkarim' into 'development'
mkarim-rtx Nov 5, 2024
e1ca178
added the datatime-fortran soruce to the ngen source tree and updated...
mkarim-rtx Nov 14, 2024
2feccbc
Merge branch 'fix_cmake_for_logging_and_datetime_libs' into 'developm…
zhengtaocui Nov 14, 2024
d67fdf1
Sac snow17 update
mkarim-rtx Nov 16, 2024
2064b8f
Merge branch 'sac_snow17_update' into 'development'
zhengtaocui Nov 16, 2024
cd99e94
Text file containing repository version number and date
cmaynard-ngwpc Dec 2, 2024
21cbc9e
Added commit hash of official release
cmaynard-ngwpc Dec 3, 2024
bb6a6c6
Merge branch 'cmaynard_NGWPC-4611_version_file' into 'development'
cmaynard-ngwpc Dec 5, 2024
1077919
Merge branch 'development' into 'release-candidate'
cmaynard-ngwpc Jan 26, 2025
ed049ab
Updated version file for rc-1.1.0
cmaynard-ngwpc Jan 26, 2025
82a787d
Merge branch 'release_rc-1.1.0_update_version_file' into 'release-can…
cmaynard-ngwpc Jan 26, 2025
68001f6
Merge branch 'release-candidate' into 'master'
cmaynard-ngwpc Feb 1, 2025
c6bac43
update version file for releaxe 1.1.0
cmaynard-ngwpc Feb 1, 2025
705ccf1
Merge branch 'update-version-file' into 'master'
cmaynard-ngwpc Feb 1, 2025
68a35a2
Merge branch 'master' into 'development'
cmaynard-ngwpc Feb 1, 2025
f15c2cb
Added RTX licensing verbiage
cmaynard-ngwpc Feb 6, 2025
8d0473b
Merge branch 'add_rtx_licencing' into 'development'
cmaynard-ngwpc Feb 6, 2025
d604876
Merge branch 'development' into 'release-candidate'
cmaynard-ngwpc Feb 13, 2025
f6d4df6
Update version file for release rc-1.2.0 on 2025-02-12
cmaynard-ngwpc Feb 13, 2025
8f6ba00
Merge branch 'update_version_file_rc-1.2.0' into 'release-candidate'
cmaynard-ngwpc Feb 13, 2025
a36733f
Merge branch 'release-candidate' into 'development'
cmaynard-ngwpc Feb 13, 2025
e0378ab
Merge branch 'release-candidate' into 'master'
cmaynard-ngwpc Feb 26, 2025
954e44f
Update version file for release 1.2.0 on 2025-02-25
cmaynard-ngwpc Feb 26, 2025
98511bd
Merge branch 'update_version_file_1.2.0' into 'master'
cmaynard-ngwpc Feb 26, 2025
e5a3f37
Merge branch 'master' into 'development'
cmaynard-ngwpc Feb 26, 2025
353e03f
Merge branch 'master' into 'release-candidate'
cmaynard-ngwpc Mar 14, 2025
a436c1b
Delete version.txt
peterkronenberg-rtx Mar 19, 2025
ed9bf86
Merge branch 'peter_delete_version' into 'development'
peterkronenberg-rtx Apr 9, 2025
6ec3e7b
Add check for logging enabled, change log levels ERROR to WARNING and…
cmaynard-ngwpc May 6, 2025
912136b
Merge branch 'cmaynard_NGWPC_5709_logging_enabled_updates' into 'deve…
cmaynard-ngwpc May 7, 2025
e49529a
Merge branch 'development' into 'release-candidate'
cmaynard-ngwpc Jun 11, 2025
a3434c2
Remove superfluous print where write_log exist.
cmaynard-ngwpc Jun 26, 2025
d989182
Merge branch 'cmaynard_fix_logger_rtoa' into 'release-candidate'
cmaynard-ngwpc Jun 26, 2025
5e64f5c
Merge branch 'release-candidate' into 'development'
cmaynard-ngwpc Jun 27, 2025
8dcd380
Merge remote-tracking branch 'github/master' into owp-merge-github-ma…
PhilMiller Jul 16, 2025
0747f9a
Merge branch 'owp-merge-github-master' into 'development'
cmaynard-ngwpc Jul 23, 2025
a2d3ec4
Merge pull request #1 from NGWPC/development
cmaynard-ngwpc Sep 9, 2025
92b7fa1
fix swe/snow depth unit issue
Sep 10, 2025
cdb4bf2
Merge pull request #3 from NGWPC/yliu_fix_swe_unit
yuqiong77 Sep 10, 2025
0087c51
Merge pull request #4 from NGWPC/development
cmaynard-ngwpc Sep 10, 2025
494f040
Fix recursive calling of write_log. Added logger steps for standalone…
cmaynard-ngwpc Sep 19, 2025
1522847
Update INSTALL.md on using logger when running standalone
cmaynard-ngwpc Sep 22, 2025
b381914
Merge pull request #6 from NGWPC/cmaynard_NGWPC-8295_fix_logger_recur…
cmaynard-ngwpc Sep 22, 2025
dc66c94
fix negative raim from snow17
Sep 18, 2025
571803e
change log level from WARNING to INFO
Sep 22, 2025
989758b
Merge pull request #5 from NGWPC/yliu_NGWPC-8227_snow17_negative_melt
yuqiong77 Sep 22, 2025
ee83d3d
Merge pull request #7 from NGWPC/release-candidate
cmaynard-ngwpc Sep 22, 2025
6c4f3c7
Added get/set values functions in the BMI class. Also added the neces…
sivasankkar Oct 20, 2025
161825a
Added all logic for serialization and deserialization for snow17
sivasankkar Oct 21, 2025
5ab03cc
Snow17 serialization routines and functions.
sivasankkar Oct 22, 2025
0771160
Updates made to convert the stop commands in deserialization to setti…
sivasankkar Nov 13, 2025
62e1348
Changed stop commands. Missed to stage this in previous commit.
sivasankkar Nov 13, 2025
986f0ae
Updated deserialize_mp_buffer subroutine for readability - if-then c…
sivasankkar Nov 17, 2025
d916316
Merge pull request #8 from NGWPC/ssn-6525-snow17-statesaving
PhilMiller Nov 17, 2025
dbcfd09
Merge pull request #9 from NGWPC/development
cmaynard-ngwpc Dec 3, 2025
adf319c
Merge pull request #10 from NGWPC/ngwpc-candidate
cmaynard-ngwpc Dec 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ cmake_minimum_required(VERSION 3.12)
enable_language( Fortran )
add_subdirectory(../iso_c_fortran_bmi ${CMAKE_BINARY_DIR}/iso_c_bmi)

set( CMAKE_VERBOSE_MAKEFILE on )

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../cmake/")
# Uncomment this and rebuild artifacts to enable debugging
#set(CMAKE_BUILD_TYPE Debug)

add_compile_options(
"-Wall"
"$<$<CONFIG:DEBUG>:-g;-fbacktrace;-fbounds-check>"
Expand Down Expand Up @@ -63,7 +66,8 @@ set(MODEL_SOURCE_DIR src/)
set(BMI_SOURCE_DIR src/bmi/)

file(GLOB BMI_SOURCE ${BMI_SOURCE_DIR}*.f90)
file( GLOB MODEL_SOURCES ${MODEL_SOURCE_DIR}/snow19/*.f ${MODEL_SOURCE_DIR}/driver/*.f90 ${MODEL_SOURCE_DIR}/share/*.f90)
#file( GLOB MODEL_SOURCES ${MODEL_SOURCE_DIR}/snow19/*.f ${MODEL_SOURCE_DIR}/driver/*.f90 ${MODEL_SOURCE_DIR}/share/*.f90)
file( GLOB MODEL_SOURCES ${MODEL_SOURCE_DIR}/snow19/*.f ${MODEL_SOURCE_DIR}/share/*.f90 ${MODEL_SOURCE_DIR}/driver/*.f90 ${CMAKE_CURRENT_LIST_DIR}/../datetime-fortran-1.7.0/src/*.f90)

if(WIN32)
add_library(snow17bmi ${BMI_SOURCE} )
Expand All @@ -72,16 +76,19 @@ else()
endif()

#target_include_directories(snow17bmi PUBLIC ${netCDF_INCLUDE_DIR} ${netCDF_MOD_PATH}) # netcdf not needed for this code
target_include_directories( snow17bmi PUBLIC )
#target_include_directories( snow17bmi PUBLIC ${FDATETIME_INCLUDE_DIRS} )

#We know we are building this for NGEN support, so define the preprocessor directive in the compile options
#Not sure why the global
target_compile_options(snow17bmi PUBLIC -cpp -ffree-line-length-none)
#target_compile_options(snow17bmi PUBLIC -O3 -fdefault-real-8 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all)

##### NETCDF #####
#target_link_libraries( snow17bmi iso_c_bmi ${netCDF_C_LIB} ${netCDF_FORTRAN_LIB})
##### END NETCDF #####
#target_link_libraries( snow17bmi PUBLIC iso_c_bmi fortran_stdlib::fortran_stdlib ${FDATETIME_LIBRARIES} )
target_link_libraries( snow17bmi PUBLIC iso_c_bmi )

set_target_properties(snow17bmi PROPERTIES VERSION ${PROJECT_VERSION})

include(GNUInstallDirs)
Expand Down
26 changes: 26 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,30 @@ cd ../output/ # to view output data
```
Note that the ex1/ example is part of the repo. The unpacked directory and test contents will not be included in a push back to the online repo. To the program for other purposes, create new input files and output directories outside of the `snow17/` repository directory, and link to the executable in `snow17/bin/`.

## Logger

The Errror Warning and Trapping Systems (EWTS) has been added to this module using a logging schema. All write statements have been converted to `write_log` statements, which saves the ouptut to a log file based on the log level.

When running within the ngen framework, the log file and log level are handled programatically. When running standalone, logging is defaulted to DISABLED.

**Running Standalone**

In order to generate log messages when running standalone, the `NGEN_EWTS_LOGGING` environment variable must be set to `ENABLED`. This is the only required environment variable . Other optional logger environment variables exist for specifying the log file full pathname and setting the log level. If the user only enables logging, the log level will be set to INFO and the filename will be created based on the user and module names. All logger setup details are written to the console when the module is run.
```
# Case Sensitive
export NGEN_EWTS_LOGGING=ENABLED
export NGEN_LOG_FILE_PATH=<full pathname for log file>
export SNOW17_LOGLEVEL=<DEBUG, INFO, WARNING, SEVERE, FATAL>
```
**Log Levels**
| Level | Description | Typical Use |
|---------|-----------------------------------------------------|-----------------------------------------------|
| DEBUG | Detailed diagnostic info for development/troubleshooting. | Variable values, function entry/exit. |
| FATAL | Critical failure that aborts or makes app unrecoverable. | Crashes, memory errors, invalid state. |
| INFO | General events confirming expected operations. | Startup/shutdown, configs, task completions. |
| SEVERE | Significant problem; app may continue in degraded state. | Failed services, corrupted configs, data loss.|
| WARNING | Potential issue that doesn’t stop execution. | Deprecated APIs, missing files, repeatable errors. |

Default log level is INFO. The log level is hierarchical. Setting it to INFO, will log INFO, WARNING, SEVERE and FATAL
messages.

22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Copyright 2025 Raytheon Company

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

Licensed under: https://opensource.org/license/bsd-2-clause

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

All rights reserved. Based on Government sponsored work under contract GS-35F-204GA.

-----------------

“Software code created by U.S. Government employees is not subject to copyright
in the United States (17 U.S.C. §105). The United States/Department of Commerce
reserve all rights to seek and obtain copyright protection in countries other
than the United States for Software authored in its entirety by the Department
of Commerce. To this end, the Department of Commerce hereby grants to Recipient
a royalty-free, nonexclusive license to use, copy, and create derivative works
of the Software outside of the United States.”

Apache License
Version 2.0, January 2004
Expand Down
135 changes: 76 additions & 59 deletions build/Makefile
Original file line number Diff line number Diff line change
@@ -1,146 +1,163 @@
#========================================================================
# Makefile to compile the Snow-17 and driver code for multi-zone model
#========================================================================

#========================================================================
# PART 1: Define directory paths and compiler

# Define main/top directory (parent of /build/)
# Note: the relative path of "../" drops into snow17 parent directory
F_MASTER_DIR = ../

DATETIME_FORTRAN_INSTALLATION_DIR=../../../extern

# Location of the compiled modules
# MOD_PATH = $(F_MASTER_DIR)/build/ -- not used

# Define directories
driver_dir = $(F_MASTER_DIR)/src/driver/
snow19_dir = $(F_MASTER_DIR)/src/snow19/
share_dir = $(F_MASTER_DIR)/src/share/
bmi_dir = $(F_MASTER_DIR)/src/bmi/
exe_dir = $(F_MASTER_DIR)/bin/

fdatetime_dir = $(DATETIME_FORTRAN_INSTALLATION_DIR)/datetime-fortran-1.7.0/src/

# Define the executable and path
EXE = $(exe_dir)/snow17.exe

# Define your Fortran compiler
#FC = pgf90
#FC = ifort
FC = gfortran

#========================================================================
# PART 2: Define the libraries and flags (can be an include file)

# --- Define the libraries and path to include files
ifeq "$(FC)" "pgf90"
LOCL_PATH = /usr/local
LIB = -L$(LOCL_PATH)/lib
LIB = -L$(LOCL_PATH)/lib
INC = -I ./
endif

ifeq "$(FC)" "gfortran"
LOCL_PATH = /usr/local
LIB = -L$(LOCL_PATH)/lib
LIB = -L$(LOCL_PATH)/lib
INC = -I ../
endif

# --- Define flags
ifeq "$(FC)" "gfortran"
FLAGS_DEBUG = -static -Wall -g -ffree-line-length-none -cpp -fcheck=all
FLAGS = -O3 -fdefault-real-8 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all
FLAGS2 = -O3 -fdefault-real-8 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all
#FLAGS = -O3 -fdefault-real-8 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all
FLAGS = -O3 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all
#FLAGS2 = -O3 -fdefault-real-8 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all
FLAGS2 = -O3 -fno-align-commons -ffree-line-length-none -cpp -fcheck=all
endif

ifeq "$(FC)" "ifort"
FLAGS_PROF = -static -debug -warn all -check all -FR -O0 -auto -WB -traceback -g -fltconsistency -fpe0
FLAGS = -O3 -warn all -check all
FLAGS2 = -O3
FLAGS77 = -O3 -f77rtl
FLAGS2 = -O3
FLAGS77 = -O3 -f77rtl
endif

ifeq "$(FC)" "pgf90"
FLAGS_PROF = -Bstatic -Mbackslash -g -Mchkptr -Mchkstk -Mpgicoff -Minform=inform -Ktrap=divz,inv -Mprof=lines,time
# FLAGS = -Mfreeform -O3 -Mbackslash -g -Mchkptr -Mchkstk -Mpgicoff -Minform=inform -Ktrap=divz,inv
FLAGS = -O3 -r8 -Kieee
FLAGS2 = -O3 -r8
endif


#========================================================================
# PART 3: Assemble all of the various subroutines

# --- snow-19 code (fortran 90, different options)
snow19 = \
zero19.f \
rout19.f \
aesc19.f \
melt19.f \
SNEW.f \
SNOWT.f \
SNOWPACK.f \
adjc19.f \
aeco19.f \
updt19.f \
SNDEPTH.f \
PACK19.f \
exsnow19.f
zero19.f \
rout19.f \
aesc19.f \
melt19.f \
SNEW.f \
SNOWT.f \
SNOWPACK.f \
adjc19.f \
aeco19.f \
updt19.f \
SNDEPTH.f \
PACK19.f \
exsnow19.f
model_snow19 = $(patsubst %, $(snow19_dir)/%, $(snow19))


# -- share utilities and code used by the driver in running the model
run_util = \
nrtype.f90 \
constants.f90 \
namelistModule.f90 \
snowLogger.f90 \
nrtype.f90 \
constants.f90 \
namelistModule.f90 \
parametersType.f90 \
forcingType.f90 \
dateTimeUtilsModule.f90 \
runInfoType.f90 \
modelVarType.f90 \
ioModule.f90 \
runSnow17.f90
byte_utilities.f90 \
messagepack_value.f90 \
messagepack_user.f90 \
messagepack.f90 \
runSnow17.f90

model_run = $(patsubst %, $(share_dir)/%, $(run_util))

# --- BMI functions used by the driver to run the model
bmi_functions = bmi.f90 bmi_snow17.f90
snow17_bmi = $(patsubst %, $(bmi_dir)/%, $(bmi_functions))

fdatetime_code = datetime_module.f90
fdatetime = $(patsubst %, $(fdatetime_dir)/%, $(fdatetime_code))

# --- snow17 driver
driver_snow17 = driver_bmi.f90
snow17_drv = $(patsubst %, $(driver_dir)/%, $(driver_snow17))


# --- prepare to stitch it all together # check just using the original names ... this does nothing?
run_code = $(model_run)
model = $(model_snow19)
bmi = $(snow17_bmi)


#========================================================================
# PART 4: Compile it

all: model link clean
# PART 4: Compile it
all: model link clean
debug: model_debug link
devel: model link

devel: model link
check:
echo test
echo $(FC)

# compile model code
model:
$(FC) $(FLAGS2) -c $(model) $(INC)
#$(FC) $(FLAGS2) -c $(model) $(INC) $(STDLIB_CFLAGS) $(DATETIME_F_CFLAGS)
$(FC) $(FLAGS2) -c $(model) $(fdatetime) $(INC)
#$(FC) $(FLAGS) -c $(run_code) $(bmi) $(snow17_drv) $(INC) $(STDLIB_CFLAGS) $(DATETIME_F_CFLAGS)
$(FC) $(FLAGS) -c $(run_code) $(bmi) $(snow17_drv) $(INC)

model_debug:
$(FC) $(FLAGS2) -g -fcheck=all -c $(model) $(INC)
$(FC) $(FLAGS) -g -fcheck=all -c $(run_code) $(bmi) $(snow17_drv) $(INC)

#$(FC) $(FLAGS2) -g -fcheck=all -c $(model) $(INC) $(STDLIB_CFLAGS) $(DATETIME_F_CFLAGS)
$(FC) $(FLAGS2) -g -fcheck=all -c $(model) $(fdatetime) $(INC)
#$(FC) $(FLAGS) -g -fcheck=all -c $(run_code) $(bmi) $(snow17_drv) $(INC) $(STDLIB_CFLAGS) $(DATETIME_F_CFLAGS)
(FC) $(FLAGS) -g -fcheck=all -c $(run_code) $(bmi) $(snow17_drv) $(INC)

# link routines
link:
# $(FC) -fPIC -Bstatic_pgi -rpath,/usr/local/netcdf4-pgi/lib *.o -I./ $(LIBNETCDF) -o $(EXE)
$(FC) -fPIC -I./ $(LIB) -o $(EXE) *.o

# $(FC) -fPIC -Bstatic_pgi -rpath,/usr/local/netcdf4-pgi/lib *.o -I./ $(LIBNETCDF) -o $(EXE)
#$(FC) -fPIC -I./ $(LIB) -o $(EXE) *.o $(STDLIB_LIBS) $(DATETIME_F_LIBS)
$(FC) -fPIC -I./ $(LIB) -o $(EXE) *.o

# Remove object files
clean:
rm -f *.o
Expand Down
Loading