diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 60f07dcf..f6dc78b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,9 @@ jobs: autoreconf -i ../configure.ac ../configure $MPI $QUAD_P || cat config.log - name: Build - run: make -C build -j + # Due to how some compilers handle the Fortran module files, we + # need to run the build twice + run: make -C build -j || make -C build -j - name: Run most tests (skip the slow ones) run: make -C build -j check - name: Save log file on failure diff --git a/.vscode/cspell.json b/.vscode/cspell.json new file mode 100644 index 00000000..323f33df --- /dev/null +++ b/.vscode/cspell.json @@ -0,0 +1,141 @@ +{ + "version": "0.2", + "language": "en", + "dictionaryDefinitions": [ + { + "name": "people", + "path": "dicts/people.txt", + "description": "A list of people's names", + "addWords": true + }, + { + "name": "fre-nctools", + "path": "dicts/fre-nctools.txt", + "description": "A list of words used in the nctools project", + "addWords": true + }, + { + "name": "autoconf", + "path": "dicts/autoconf.txt", + "description": "A list of words used in autoconf files", + "addWords": false + }, + { + "name": "automake", + "path": "dicts/automake.txt", + "description": "A list of words used in automake files", + "addWords": false + }, + { + "name": "fortran", + "path": "dicts/fortran.txt", + "description": "A list of Fortran keywords", + "addWords": false + } + ], + "dictionaries": [ + "people", + "fortran", + "fre-nctools", + "scientific-terms-us", + ], + "enabledLanguageIds": [ + "automake", + "c", + "cpp", + "fortran", + "plaintext", + ], + "languageSettings":[ + { + // use with cpp or c files + "languageId": "cpp,c", + // turn off compound words, because it is only checking strings. + "allowCompoundWords": false, + "patterns": [ + { + "name": "FtnStyleComment", + "pattern": ["!(?:.*)"], + "description": "Fortran style comments" + } + ], + // Only check comments and strings + "includeRegExpList": [ + "CStyleComment", + "string" + ], + // Exclude includes, because they are also strings. + "ignoreRegExpList": [ + "/#include.*/", + ], + "dictionaries": [ + ] + }, + { + "languageId": "fortran", + "patterns": [ + { + "name": "FtnStyleComment", + "pattern": ["!(?:.*)"], + "description": "Fortran style comments" + } + ], + "includeRegExpList": [ + "FtnStyleComment", + "string" + ], + "dictionaries": [ + "fortran" + ], + }, + { + "languageId": "autoconf", + "patterns": [ + { + "name": "AutoconfComment", + "pattern": ["#(?:.*)"], + "description": "Autoconf style comments" + } + ], + "includeRegExpList": [ + "AutoconfComment", + "string" + ], + "dictionaries": [ + "autoconf" + ], + }, + { + "languageId": "automake", + "patterns": [ + { + "name": "AutomakeComment", + "pattern": ["#(?:.*)"], + "description": "Automake style comments" + } + ], + "includeRegExpList": [ + "AutomakeComment", + "string" + ], + "dictionaries": [ + "automake" + ], + }, + ], + "overrides": [ + { + "filename": "*.{f90,F90,f,F,for,ftn,Ftn,FOR,FTN,inc}", + "languageId": "fortran", + }, + { + "filename": "*.{ac,m4}", + "languageId": "autoconf" + }, + { + "filename": "*.am", + "languageId": "automake" + } + ] + +} \ No newline at end of file diff --git a/.vscode/dicts/autoconf.txt b/.vscode/dicts/autoconf.txt new file mode 100644 index 00000000..d57f2c68 --- /dev/null +++ b/.vscode/dicts/autoconf.txt @@ -0,0 +1,1001 @@ +# Key words, variables and macros used in autoconf + +AC_AIX +AC_ALLOCA +AC_ARG_ARRAY +AC_ARG_ENABLE +AC_ARG_PROGRAM +AC_ARG_VAR +AC_ARG_WITH +AC_AUTOCONF_VERSION +AC_BEFORE +AC_CACHE_CHECK +AC_CACHE_LOAD +AC_CACHE_SAVE +AC_CACHE_VAL +AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_SYSTEM +AC_CANONICAL_TARGET +AC_CHAR_UNSIGNED +AC_CHECKING +AC_CHECK_ALIGNOF +AC_CHECK_DECL +AC_CHECK_DECLS +AC_CHECK_DECLS_ONCE +AC_CHECK_FILE +AC_CHECK_FILES +AC_CHECK_FUNC +AC_CHECK_FUNCS +AC_CHECK_FUNCS_ONCE +AC_CHECK_HEADER +AC_CHECK_HEADERS +AC_CHECK_HEADERS_ONCE +AC_CHECK_LIB +AC_CHECK_MEMBER +AC_CHECK_MEMBERS +AC_CHECK_PROG +AC_CHECK_PROGS +AC_CHECK_SIZEOF +AC_CHECK_TARGET_TOOL +AC_CHECK_TARGET_TOOLS +AC_CHECK_TOOL +AC_CHECK_TOOLS +AC_CHECK_TYPE +AC_CHECK_TYPES +AC_COMPILE_CHECK +AC_COMPILE_IFELSE +AC_COMPUTE_INT +AC_CONFIG_AUX_DIR +AC_CONFIG_COMMANDS +AC_CONFIG_COMMANDS_POST +AC_CONFIG_COMMANDS_PRE +AC_CONFIG_FILES +AC_CONFIG_HEADERS +AC_CONFIG_LIBOBJ_DIR +AC_CONFIG_LINKS +AC_CONFIG_MACRO_DIR +AC_CONFIG_SRCDIR +AC_CONFIG_SUBDIRS +AC_CONFIG_TESTDIR +AC_CONST +AC_COPYRIGHT +AC_CROSS_CHECK +AC_CYGWIN +AC_C_BACKSLASH_A +AC_C_BIGENDIAN +AC_C_CHAR_UNSIGNED +AC_C_CONST +AC_C_CROSS +AC_C_FLEXIBLE_ARRAY_MEMBER +AC_C_INLINE +AC_C_LONG_DOUBLE +AC_C_PROTOTYPES +AC_C_RESTRICT +AC_C_STRINGIZE +AC_C_TYPEOF +AC_C_VARARRAYS +AC_C_VOLATILE +AC_DATAROOTDIR_CHECKED +AC_DECL_SYS_SIGLIST +AC_DECL_YYTEXT +AC_DEFINE +AC_DEFINE_UNQUOTED +AC_DEFUN +AC_DEFUN_ONCE +AC_DIAGNOSE +AC_DIR_HEADER +AC_DISABLE_OPTION_CHECKING +AC_DYNIX_SEQ +AC_EGREP_CPP +AC_EGREP_HEADER +AC_EMXOS2 +AC_ENABLE +AC_ERLANG_CHECK_LIB +AC_ERLANG_NEED_ERL +AC_ERLANG_NEED_ERLC +AC_ERLANG_PATH_ERL +AC_ERLANG_PATH_ERLC +AC_ERLANG_SUBST_INSTALL_LIB_DIR +AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR +AC_ERLANG_SUBST_LIB_DIR +AC_ERLANG_SUBST_ROOT_DIR +AC_ERROR +AC_EXEEXT +AC_F77_DUMMY_MAIN +AC_F77_FUNC +AC_F77_LIBRARY_LDFLAGS +AC_F77_MAIN +AC_F77_WRAPPERS +AC_FATAL +AC_FC_FREEFORM +AC_FC_FUNC +AC_FC_LIBRARY_LDFLAGS +AC_FC_MAIN +AC_FC_SRCEXT +AC_FC_WRAPPERS +AC_FIND_X +AC_FIND_XTRA +AC_FOREACH +AC_FUNC_ALLOCA +AC_FUNC_CHECK +AC_FUNC_CHOWN +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_ERROR_AT_LINE +AC_FUNC_FNMATCH +AC_FUNC_FNMATCH_GNU +AC_FUNC_FORK +AC_FUNC_FSEEKO +AC_FUNC_GETGROUPS +AC_FUNC_GETLOADAVG +AC_FUNC_GETMNTENT +AC_FUNC_GETPGRP +AC_FUNC_LSTAT +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +AC_FUNC_MALLOC +AC_FUNC_MBRTOWC +AC_FUNC_MEMCMP +AC_FUNC_MKTIME +AC_FUNC_MMAP +AC_FUNC_OBSTACK +AC_FUNC_REALLOC +AC_FUNC_SELECT_ARGTYPES +AC_FUNC_SETPGRP +AC_FUNC_SETVBUF_REVERSED +AC_FUNC_STAT +AC_FUNC_STRCOLL +AC_FUNC_STRERROR_R +AC_FUNC_STRFTIME +AC_FUNC_STRNLEN +AC_FUNC_STRTOD +AC_FUNC_STRTOLD +AC_FUNC_UTIME_NULL +AC_FUNC_VPRINTF +AC_FUNC_WAIT3 +AC_GCC_TRADITIONAL +AC_GETGROUPS_T +AC_GETLOADAVG +AC_GNU_SOURCE +AC_HAVE_FUNCS +AC_HAVE_HEADERS +AC_HAVE_LIBRARY +AC_HAVE_POUNDBANG +AC_HEADER_ASSERT +AC_HEADER_CHECK +AC_HEADER_DIRENT +AC_HEADER_EGREP +AC_HEADER_MAJOR +AC_HEADER_RESOLV +AC_HEADER_STAT +AC_HEADER_STDBOOL +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_HEADER_TIME +AC_HEADER_TIOCGWINSZ +AC_HELP_STRING +AC_INCLUDES_DEFAULT +AC_INIT +AC_INLINE +AC_INT_16_BITS +AC_IRIX_SUN +AC_ISC_POSIX +AC_LANG_ASSERT +AC_LANG_C +AC_LANG_CALL +AC_LANG_CONFTEST +AC_LANG_CPLUSPLUS +AC_LANG_FORTRAN77 +AC_LANG_FUNC_LINK_TRY +AC_LANG_POP +AC_LANG_PROGRAM +AC_LANG_PUSH +AC_LANG_RESTORE +AC_LANG_SAVE +AC_LANG_SOURCE +AC_LANG_WERROR +AC_LIBOBJ +AC_LIBSOURCE +AC_LIBSOURCES +AC_LINK_FILES +AC_LINK_IFELSE +AC_LN_S +AC_LONG_64_BITS +AC_LONG_DOUBLE +AC_LONG_FILE_NAMES +AC_MAJOR_HEADER +AC_MEMORY_H +AC_MINGW32 +AC_MINIX +AC_MINUS_C_MINUS_O +AC_MMAP +AC_MODE_T +AC_MSG_CHECKING +AC_MSG_ERROR +AC_MSG_FAILURE +AC_MSG_NOTICE +AC_MSG_RESULT +AC_MSG_WARN +AC_OBJEXT +AC_OBSOLETE +AC_OFF_T +AC_OPENMP +AC_OUTPUT +AC_OUTPUT_COMMANDS +AC_PACKAGE_BUGREPORT +AC_PACKAGE_NAME +AC_PACKAGE_STRING +AC_PACKAGE_TARNAME +AC_PACKAGE_VERSION +AC_PATH_PROG +AC_PATH_PROGS +AC_PATH_PROGS_FEATURE_CHECK +AC_PATH_TARGET_TOOL +AC_PATH_TOOL +AC_PATH_X +AC_PATH_XTRA +AC_PID_T +AC_PREFIX +AC_PREFIX_DEFAULT +AC_PREFIX_PROGRAM +AC_PREPROC_IFELSE +AC_PREREQ +AC_PRESERVE_HELP_ORDER +AC_PROGRAMS_CHECK +AC_PROGRAMS_PATH +AC_PROGRAM_CHECK +AC_PROGRAM_EGREP +AC_PROGRAM_PATH +AC_PROG_AWK +AC_PROG_CC +AC_PROG_CC_C89 +AC_PROG_CC_C99 +AC_PROG_CC_C_O +AC_PROG_CC_STDC +AC_PROG_CPP +AC_PROG_CPP_WERROR +AC_PROG_CXX +AC_PROG_CXXCPP +AC_PROG_CXX_C_O +AC_PROG_EGREP +AC_PROG_F77 +AC_PROG_F77_C_O +AC_PROG_FC +AC_PROG_FC_C_O +AC_PROG_FGREP +AC_PROG_GCC_TRADITIONAL +AC_PROG_GREP +AC_PROG_INSTALL +AC_PROG_LEX +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_MKDIR_P +AC_PROG_OBJC +AC_PROG_OBJCPP +AC_PROG_RANLIB +AC_PROG_SED +AC_PROG_YACC +AC_REMOTE_TAPE +AC_REPLACE_FNMATCH +AC_REPLACE_FUNCS +AC_REQUIRE +AC_REQUIRE_AUX_FILE +AC_REQUIRE_CPP +AC_RESTARTABLE_SYSCALLS +AC_RETSIGTYPE +AC_REVISION +AC_RSH +AC_RUN_IFELSE +AC_SCO_INTL +AC_SEARCH_LIBS +AC_SETVBUF_REVERSED +AC_SET_MAKE +AC_SIZEOF_TYPE +AC_SIZE_T +AC_STAT_MACROS_BROKEN +AC_STDC_HEADERS +AC_STRCOLL +AC_STRUCT_DIRENT_D_INO +AC_STRUCT_DIRENT_D_TYPE +AC_STRUCT_ST_BLKSIZE +AC_STRUCT_ST_BLOCKS +AC_STRUCT_ST_RDEV +AC_STRUCT_TIMEZONE +AC_STRUCT_TM +AC_ST_BLKSIZE +AC_ST_BLOCKS +AC_ST_RDEV +AC_SUBST +AC_SUBST_FILE +AC_SYS_INTERPRETER +AC_SYS_LARGEFILE +AC_SYS_LONG_FILE_NAMES +AC_SYS_POSIX_TERMIOS +AC_SYS_RESTARTABLE_SYSCALLS +AC_SYS_SIGLIST_DECLARED +AC_TEST_CPP +AC_TEST_PROGRAM +AC_TIMEZONE +AC_TIME_WITH_SYS_TIME +AC_TRY_COMPILE +AC_TRY_CPP +AC_TRY_LINK +AC_TRY_LINK_FUNC +AC_TRY_RUN +AC_TYPE_GETGROUPS +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_INT8_T +AC_TYPE_INTMAX_T +AC_TYPE_INTPTR_T +AC_TYPE_LONG_DOUBLE +AC_TYPE_LONG_DOUBLE_WIDER +AC_TYPE_LONG_LONG_INT +AC_TYPE_MBSTATE_T +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIGNAL +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UID_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T +AC_TYPE_UINTMAX_T +AC_TYPE_UINTPTR_T +AC_TYPE_UNSIGNED_LONG_LONG_INT +AC_UID_T +AC_UNISTD_H +AC_USE_SYSTEM_EXTENSIONS +AC_USG +AC_UTIME_NULL +AC_VALIDATE_CACHED_SYSTEM_TUPLE +AC_VERBOSE +AC_VFORK +AC_VPRINTF +AC_WAIT3 +AC_WARN +AC_WARNING +AC_WITH +AC_WORDS_BIGENDIAN +AC_XENIX_DIR +AC_YYTEXT_POINTER +AH_BOTTOM +AH_HEADER +AH_TEMPLATE +AH_TOP +AH_VERBATIM +ALIGNOF_type +ALLOCA +AS_BOURNE_COMPATIBLE +AS_CASE +AS_DIRNAME +AS_HELP_STRING +AS_IF +AS_INIT +AS_MESSAGE_FD +AS_MESSAGE_LOG_FD +AS_MKDIR_P +AS_ORIGINAL_STDIN_FD +AS_SET_CATFILE +AS_SHELL_SANITIZE +AS_TR_CPP +AS_TR_SH +AT_BANNER +AT_CAPTURE_FILE +AT_CHECK +AT_CLEANUP +AT_COPYRIGHT +AT_DATA +AT_INIT +AT_KEYWORDS +AT_PACKAGE_BUGREPORT +AT_PACKAGE_NAME +AT_PACKAGE_STRING +AT_PACKAGE_TARNAME +AT_PACKAGE_VERSION +AT_SETUP +AT_TESTED +AT_XFAIL_IF +AU_ALIAS +AU_DEFUN +AWK +Awk +BIN_SH +CC +CDPATH +CFLAGS +CLOSEDIR_VOID +CONFIG_COMMANDS +CONFIG_FILES +CONFIG_HEADERS +CONFIG_LINKS +CONFIG_SHELL +CONFIG_SITE +CONFIG_STATUS +CPP +CPPFLAGS +CXX +CXXCPP +CXXFLAGS +CXX_NO_MINUS_C_MINUS_O +CYGWIN +C_ALLOCA +C_GETLOADAVG +DEFS +DGUX +DIRENT +DUALCASE +ECHO_C +ECHO_N +ECHO_T +EGREP +ENV +ERL +ERLANG_INSTALL_LIB_DIR +ERLANG_INSTALL_LIB_DIR_library +ERLANG_LIB_DIR +ERLANG_LIB_DIR_library +ERLANG_LIB_VER_library +ERLANG_ROOT_DIR +ERLC +ERLCFLAGS +EXEEXT +F77 +F77_DUMMY_MAIN +F77_FUNC +F77_FUNC_ +F77_MAIN +F77_NO_MINUS_C_MINUS_O +FC +FCFLAGS +FCLIBS +FC_FUNC +FC_FUNC_ +FC_MAIN +FC_NO_MINUS_C_MINUS_O +FFLAGS +FGREP +FLEXIBLE_ARRAY_MEMBER +FLIBS +GETGROUPS_LIBS +GETGROUPS_T +GETLOADAVG_LIBS +GETLOADAVG_PRIVILEGED +GETPGRP_VOID +GREP +GWINSZ_IN_SYS_IOCTL +HAVE_ALLOCA_H +HAVE_CHOWN +HAVE_CONFIG_H +HAVE_C_BACKSLASH_A +HAVE_C_VARARRAYS +HAVE_DECL_STRERROR_R +HAVE_DECL_TZNAME +HAVE_DECL_symbol +HAVE_DIRENT_H +HAVE_DOPRNT +HAVE_FSEEKO +HAVE_GETGROUPS +HAVE_GETMNTENT +HAVE_INT16_T +HAVE_INT32_T +HAVE_INT64_T +HAVE_INT8_T +HAVE_INTMAX_T +HAVE_INTPTR_T +HAVE_LONG_DOUBLE +HAVE_LONG_DOUBLE_WIDER +HAVE_LONG_FILE_NAMES +HAVE_LONG_LONG_INT +HAVE_LSTAT_EMPTY_STRING_BUG +HAVE_MALLOC +HAVE_MBRTOWC +HAVE_MMAP +HAVE_NDIR_H +HAVE_NLIST_H +HAVE_OBSTACK +HAVE_REALLOC +HAVE_RESOLV_H +HAVE_RESTARTABLE_SYSCALLS +HAVE_STAT_EMPTY_STRING_BUG +HAVE_STDBOOL_H +HAVE_STRCOLL +HAVE_STRERROR_R +HAVE_STRFTIME +HAVE_STRINGIZE +HAVE_STRNLEN +HAVE_STRTOLD +HAVE_STRUCT_DIRENT_D_INO +HAVE_STRUCT_DIRENT_D_TYPE +HAVE_STRUCT_STAT_ST_BLKSIZE +HAVE_STRUCT_STAT_ST_BLOCKS +HAVE_STRUCT_STAT_ST_RDEV +HAVE_STRUCT_TM_TM_ZONE +HAVE_ST_BLKSIZE +HAVE_ST_BLOCKS +HAVE_ST_RDEV +HAVE_SYS_DIR_H +HAVE_SYS_NDIR_H +HAVE_SYS_WAIT_H +HAVE_TM_ZONE +HAVE_TYPEOF +HAVE_TZNAME +HAVE_UINT16_T +HAVE_UINT32_T +HAVE_UINT64_T +HAVE_UINT8_T +HAVE_UINTMAX_T +HAVE_UINTPTR_T +HAVE_UNSIGNED_LONG_LONG_INT +HAVE_UTIME_NULL +HAVE_VFORK_H +HAVE_VPRINTF +HAVE_WAIT3 +HAVE_WORKING_FORK +HAVE_WORKING_VFORK +HAVE__BOOL +HAVE_aggregate_member +HAVE_function +HAVE_header +HAVE_type +IFS +INSTALL +INSTALL_DATA +INSTALL_PROGRAM +INSTALL_SCRIPT +INT_16_BITS +KMEM_GROUP +LANG +LANGUAGE +LC_ADDRESS +LC_ALL +LC_COLLATE +LC_CTYPE +LC_IDENTIFICATION +LC_MEASUREMENT +LC_MESSAGES +LC_MONETARY +LC_NAME +LC_NUMERIC +LC_PAPER +LC_TELEPHONE +LC_TIME +LDFLAGS +LEX +LEXLIB +LEX_OUTPUT_ROOT +LIBOBJDIR +LIBOBJS +LIBS +LN_S +LONG_64_BITS +LSTAT_FOLLOWS_SLASHED_SYMLINK +M4 +MAIL +MAILPATH +MAJOR_IN_MKDEV +MAJOR_IN_SYSMACROS +MKDIR_P +NDEBUG +NDIR +NEED_MEMORY_H +NEED_SETGID +NLIST_NAME_UNION +NO_MINUS_C_MINUS_O +NULLCMD +Next +OBJC +OBJCFLAGS +OBJCPP +OBJEXT +OPENMP_CFLAGS +OPENMP_CXXFLAGS +OPENMP_FCFLAGS +OPENMP_FFLAGS +PACKAGE_BUGREPORT +PACKAGE_NAME +PACKAGE_STRING +PACKAGE_TARNAME +PACKAGE_VERSION +PARAMS +PATH_SEPARATOR +POW_LIB +PROTOTYPES +PS1 +PS2 +PS4 +PWD +RANLIB +RETSIGTYPE +SED +SELECT_TYPE_ARG1 +SELECT_TYPE_ARG234 +SELECT_TYPE_ARG5 +SETPGRP_VOID +SETVBUF_REVERSED +SET_MAKE +SIMPLE_BACKUP_SUFFIX +SIZEOF_ +STAT_MACROS_BROKEN +STDC_HEADERS +STRERROR_R_CHAR_P +SVR4 +SYSDIR +SYSNDIR +SYS_SIGLIST_DECLARED +TIME_WITH_SYS_TIME +TM_IN_SYS_TIME +UMAX +UMAX4_3 +USG +WARNINGS +WORDS_BIGENDIAN +XMKMF +X_CFLAGS +X_DISPLAY_MISSING +X_EXTRA_LIBS +X_LIBS +X_PRE_LIBS +YACC +YYTEXT_POINTER +_ALL_SOURCE +_FILE_OFFSET_BITS +_GNU_SOURCE +_LARGEFILE_SOURCE +_LARGE_FILES +_MINIX +_OPENMP +_POSIX_1_SOURCE +_POSIX_PTHREAD_SEMANTICS +_POSIX_SOURCE +_POSIX_VERSION +_TANDEM_SOURCE +__CHAR_UNSIGNED__ +__EXTENSIONS__ +__PROTOTYPES +__file__ +__line__ +__oline__ +abs_builddir +abs_srcdir +abs_top_builddir +abs_top_srcdir +alloca +alloca.h +assert.h +basename +bindir +break +build +build_alias +build_cpu +build_os +build_vendor +builddir +case +cat +cc +cd +chmod +chown +closedir +cmp +configure_input +const +cp +cross_compiling +ctype.h +datadir +datarootdir +date +diff +dirent.h +dirname +dnl +docdir +dvidir +echo +egrep +error_at_line +eval +exec +exec_prefix +exit +export +expr +false +fgrep +find +float.h +fnmatch +fnmatch.h +for +fork +free +fseeko +ftello +getgroups +getloadavg +getmntent +getpgid +getpgrp +gid_t +grep +host +host_alias +host_cpu +host_os +host_vendor +htmldir +if +includedir +infodir +inline +int16_t +int32_t +int64_t +int8_t +intmax_t +intptr_t +inttypes.h +isinf +isnan +join +ksh +libdir +libexecdir +linux/irda.h +linux/random.h +ln +localedir +localstatedir +ls +lstat +m4_append +m4_append_uniq +m4_append_uniq_w +m4_apply +m4_assert +m4_bmatch +m4_bpatsubst +m4_bpatsubsts +m4_bregexp +m4_builtin +m4_car +m4_case +m4_cdr +m4_changecom +m4_changequote +m4_cmp +m4_combine +m4_cond +m4_count +m4_debugfile +m4_debugmode +m4_decr +m4_default +m4_define +m4_defn +m4_divert +m4_divert_once +m4_divert_pop +m4_divert_push +m4_divert_text +m4_divnum +m4_do +m4_dquote +m4_dquote_elt +m4_dumpdef +m4_echo +m4_errprint +m4_errprintn +m4_esyscmd +m4_eval +m4_exit +m4_expand +m4_fatal +m4_flatten +m4_for +m4_foreach +m4_foreach_w +m4_format +m4_if +m4_ifdef +m4_ifndef +m4_ifset +m4_ifval +m4_ifvaln +m4_ignore +m4_include +m4_incr +m4_index +m4_indir +m4_init +m4_join +m4_joinall +m4_len +m4_list_cmp +m4_location +m4_make_list +m4_maketemp +m4_map +m4_map_sep +m4_mapall +m4_mapall_sep +m4_max +m4_min +m4_mkstemp +m4_n +m4_newline +m4_normalize +m4_pattern_allow +m4_pattern_forbid +m4_popdef +m4_pushdef +m4_quote +m4_re_escape +m4_reverse +m4_set_add +m4_set_add_all +m4_set_contains +m4_set_contents +m4_set_delete +m4_set_difference +m4_set_dump +m4_set_empty +m4_set_foreach +m4_set_intersection +m4_set_list +m4_set_listc +m4_set_remove +m4_set_size +m4_set_union +m4_shift +m4_shift2 +m4_shift3 +m4_shiftn +m4_sign +m4_sinclude +m4_split +m4_strip +m4_substr +m4_syscmd +m4_sysval +m4_text_box +m4_text_wrap +m4_tolower +m4_toupper +m4_traceoff +m4_traceon +m4_translit +m4_undefine +m4_undivert +m4_unquote +m4_version_compare +m4_warn +m4_wrap +m4_wrap_lifo +make +malloc +mandir +mbrtowc +mbstate_t +memcmp +mkdir +mktemp +mktime +mmap +mode_t +mv +ndir.h +net/if.h +netinet/if_ether.h +nlist.h +od +off_t +oldincludedir +pdfdir +pdksh +pid_t +prefix +printf +program_transform_name +psdir +putenv +pwd +read +realloc +resolv.h +restrict +rm +sbindir +sed +select +set +setpgrp +setvbuf +sharedstatedir +shift +sigaction +signal +signal.h +size_t +snprintf +source +sprintf +srcdir +sscanf +ssize_t +stat +stdarg.h +stdbool.h +stdint.h +stdlib.h +strcoll +strerror_r +strftime +string.h +strings.h +strnlen +strtod +strtold +subdirs +sys/dir.h +sys/ioctl.h +sys/mkdev.h +sys/mount.h +sys/ndir.h +sys/ptem.h +sys/socket.h +sys/stat.h +sys/sysmacros.h +sys/time.h +sys/types.h +sys/ucred.h +sys/wait.h +sysconf +sysconfdir +system.h +target +target_alias +target_cpu +target_os +target_vendor +termios.h +test +time.h +top_build_prefix +top_builddir +top_srcdir +touch +tr +trap +true +typeof +uid_t +uint16_t +uint32_t +uint64_t +uint8_t +uintmax_t +uintptr_t +unistd.h +unlink +unset +unsetenv +utime +va_copy +va_list +variable +vfork +vfork.h +volatile +vprintf +vsnprintf +vsprintf +-Werror +wait3 +wchar.h diff --git a/.vscode/dicts/automake.txt b/.vscode/dicts/automake.txt new file mode 100644 index 00000000..d439bf81 --- /dev/null +++ b/.vscode/dicts/automake.txt @@ -0,0 +1,222 @@ +# Terms used in automake files + +LDADD +LDFLAGS +LIBADD +SOURCES +TEXINFOS +ACLOCAL_AMFLAGS +AC_CANONICAL_HOST +AC_CANONICAL_SYSTEM +AC_CONFIG_AUX_DIR +AC_CONFIG_FILES +AC_CONFIG_HEADERS +AC_DEFUN +AC_F77_LIBRARY_LDFLAGS +AC_LIBOBJ +AC_LIBOBJ +AC_LIBSOURCE +AC_LIBSOURCES +AC_OUTPUT +AC_PREREQ +AC_PROG_CXX +AC_PROG_F77 +AC_PROG_LEX +AC_PROG_LIBTOOL +AC_PROG_RANLIB +AC_PROG_YACC +AC_SUBST +AM_CFLAGS +AM_CONDITIONAL +AM_CONDITIONAL +AM_CONFIG_HEADER +AM_CPPFLAGS +am_cv_sys_posix_termios +AM_CXXFLAGS +AM_C_PROTOTYPES +AM_C_PROTOTYPES +AM_C_PROTOTYPES +AM_ETAGSFLAGS +AM_FFLAGS +AM_GCJFLAGS +AM_GNU_GETTEXT +AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL +AM_INIT_AUTOMAKE +AM_INSTALLCHECK_STD_OPTIONS_EXEMPT +AM_JAVACFLAGS +AM_LDFLAGS +AM_LDFLAGS +AM_MAINTAINER_MODE +AM_MAINTAINER_MODE +AM_MAKEINFOFLAGS +AM_PATH_LISPDIR +AM_PROG_GCJ +AM_RFLAGS +AM_RUNTESTFLAGS +AUTOCONF +AUTOMAKE_OPTIONS +AUTOMAKE_OPTIONS +AUTOMAKE_OPTIONS + +bin_PROGRAMS +bin_SCRIPTS +build_alias +BUILT_SOURCES + +CC +CCAS +CCASFLAGS +CFLAGS +check_LTLIBRARIES +check_PROGRAMS +check_SCRIPTS +CLASSPATH_ENV +CLEANFILES +COMPILE +CPPFLAGS +CXX +CXXCOMPILE +CXXFLAGS +CXXLINK + +DATA +data_DATA +DEFS +DEJATOOL +DESTDIR +DISTCHECK_CONFIGURE_FLAGS +distcleancheck_listfiles +distcleancheck_listfiles +distcleancheck_listfiles +DISTCLEANFILES +distuninstallcheck_listfiles +dist_ +dist_lisp_LISP +dist_noinst_LISP +DIST_SUBDIRS +DIST_SUBDIRS + +ELCFILES +ETAGSFLAGS +ETAGS_ARGS +EXPECT +EXTRA_DIST +EXTRA_PROGRAMS + +F77 +F77COMPILE +FFLAGS +FLINK + +GCJFLAGS +GTAGS_ARGS + +HEADERS +HEADERS +host_alias +host_triplet + +INCLUDES +include_HEADERS +info_TEXINFOS + +JAVA +JAVAC +JAVACFLAGS +JAVAROOT + +LDADD +LDFLAGS +LIBADD +libexec_PROGRAMS +libexec_SCRIPTS +LIBOBJS +LIBOBJS +LIBRARIES +LIBS +lib_LIBRARIES +lib_LTLIBRARIES +LINK +LISP +LISP +lisp_LISP +localstate_DATA +LTLIBOBJS + +MAINTAINERCLEANFILES +MAKE +MAKEFLAGS +MAKEINFO +MAKEINFOFLAGS +MANS +MANS +man_MANS +MOSTLYCLEANFILES + +nodist_ +noinst_HEADERS +noinst_LIBRARIES +noinst_LISP +noinst_LTLIBRARIES +noinst_PROGRAMS +noinst_SCRIPTS + +oldinclude_HEADERS + +PACKAGE +pkgdatadir +pkgdata_DATA +pkgdata_SCRIPTS +pkgincludedir +pkginclude_HEADERS +pkglibdir +pkglib_LIBRARIES +pkglib_LTLIBRARIES +pkglib_PROGRAMS +pkglibexecdir +pkgpyexecdir +pkgpythondir +PROGRAMS +PROGRAMS +pyexecdir +PYTHON +pythondir +PYTHON_EXEC_PREFIX +PYTHON_PLATFORM +PYTHON_PREFIX +PYTHON_VERSION + +RFLAGS +RUNTEST +RUNTESTDEFAULTFLAGS +RUNTESTFLAGS + +sbin_PROGRAMS +sbin_SCRIPTS +SCRIPTS +SCRIPTS +sharedstate_DATA +SOURCES +SUBDIRS +SUFFIXES +sysconf_DATA + +TAGS_DEPENDENCIES +target_alias +TESTS +TESTS_ENVIRONMENT +TEXINFOS +TEXINFOS +TEXINFOS +TEXINFO_TEX + +VERSION +VERSION, prevent definition + +WARNINGS +WITH_DMALLOC +WITH_REGEX + +XFAIL_TESTS + +YACC diff --git a/.vscode/dicts/fortran.txt b/.vscode/dicts/fortran.txt new file mode 100644 index 00000000..46dbac3b --- /dev/null +++ b/.vscode/dicts/fortran.txt @@ -0,0 +1,117 @@ +# Fortran keywords +# From https://fortranwiki.org/fortran/show/Keywords + +# FORTRAN 77 +assign +backspace +block data +call +close +common +continue +data +dimension +do +else +else if +end +endfile +endif +entry +equivalence +external +format +function +goto +if +implicit +inquire +intrinsic +open +parameter +pause +print +program +read +return +rewind +rewrite +save +stop +subroutine +then +write + +# Fortran 90 +allocatable +allocate +case +contains +cycle +deallocate +elsewhere +exit? +include +interface +intent +module +namelist +nullify +only +operator +optional +pointer +private +procedure +public +recursive +result +select +sequence +target +use +while +where + +# Fortran 95 +elemental +forall +pure + +# Fortran 2003 +abstract +associate +asynchronous +bind +class +deferred +enum +enumerator +extends +final +flush +generic +import +non_overridable +nopass +pass +protected +value +volatile +wait + +# Fortran 2008 +block +codimension +contiguous +critical +submodule +sync all +sync images +sync memory +lock +unlock +impure + +# Fortran 2018 +non_recursive \ No newline at end of file diff --git a/.vscode/dicts/fre-nctools.txt b/.vscode/dicts/fre-nctools.txt new file mode 100644 index 00000000..69328dc6 --- /dev/null +++ b/.vscode/dicts/fre-nctools.txt @@ -0,0 +1,97 @@ +# names of applications and variables used in the tools + +advective +check_mask +combine-ncc +combine_restarts +decompress-ncc +fregrid +fre-nctools +gridfiles +hgrid +iceberg_comb.sh +interp +is-compressed +levitus +libfrencutils +libnctf +libver +list_ncvars +list_ncvars.csh +list_ncvars.sh +make_coupler_mosaic +make_hgrid +make_land_domain +make_quick_mosaic +make_regional_mosaic +make_remap_file +make_solo_mosaic +make_topog +make_vgrid +mppnccombine +mppncscatter +ncexists +ntiles +npes +package_bugreport +plevel_interp +plevel.sh +regrid +regridded +regridding +remap_land +river_regrid +runoff_regrid +scatter-ncc +split_ncvars.pl +timavg +time_average +tripolar +vgrid +Xlayout +Ylayout + +# Land types +land +cana +snow +glac +lake +soil +vegn + +# External packages +ncdump +ncgen +ncrcat +ncatted +ncks +ncview +mpirun +mpiexec +srun +netCDF +netcdff + +# Development terms used in FRE-NCtools +openacc +getrusage +sched +getaffinity +hashval +rpath +CC +FC +CFLAGS +FCFLAGS +LDFLAGS +autoreconf +autotools +nvfortran + +# Terms used across NOAA +NOAA +CMIP + +# Other Terms +spack \ No newline at end of file diff --git a/.vscode/dicts/people.txt b/.vscode/dicts/people.txt new file mode 100644 index 00000000..927f155c --- /dev/null +++ b/.vscode/dicts/people.txt @@ -0,0 +1,31 @@ +# Names of people + +Balaji +Forrestal +Malyshev +Mohan +NCEP +Sergey +Tauber +Tushar +Vahlenkamp +Zhi +Liang +Niki +Zadeh +Aleksey +Yakovelv +Wyman +Fritsch +Kahaner +Moler +Englewood +Pacanowski +Legg +Scripps +Remik +Ziemlinski +Zuniga +Vinod +Kumar +Mulhall \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index c50935ec..235237b1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,42 +1,4 @@ { - "cSpell.words": [ - "Balaji", - "Forrestal", - "fregrid", - "hght", - "Malyshev", - "Mohan", - "mppnccombine", - "NCEP", - "plevel", - "plevs", - "reananalysis", - "regridded", - "regridding", - "Sergey", - "sphum", - "Tauber", - "Tushar", - "Vahlenkamp", - "zsurf" - ], - "cSpell.languageSettings": [ - { - // use with cpp or c files - "languageId": "cpp,c", - // turn off compound words, because it is only checking strings. - "allowCompoundWords": false, - // Only check comments and strings - "includeRegExpList": [ - "CStyleComment", - "string" - ], - // Exclude includes, because they are also strings. - "ignoreRegExpList": [ - "/#include.*/", - ] - } - ], "makefile.dryrunSwitches": [ "--always-make", "--print-directory", diff --git a/Makefile.am b/Makefile.am index fa918b0e..ccab82dd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,42 +19,16 @@ #*********************************************************************** ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = lib/libnfu \ +SUBDIRS = lib \ src \ - tools/libfrencutils \ - tools/check_mask \ - tools/cubic_utils \ - tools/fregrid \ - tools/make_coupler_mosaic \ - tools/make_hgrid \ - tools/make_land_domain \ - tools/make_quick_mosaic \ - tools/make_regional_mosaic \ - tools/make_solo_mosaic \ - tools/make_topog \ - tools/make_vgrid \ - tools/mppncscatter \ - tools/ncexists \ - tools/remap_land \ - tools/river_regrid \ - tools/runoff_regrid \ - tools/transfer_to_mosaic_grid \ tools/simple_hydrog \ - tools/simple_hydrog/libfmslite \ tools/simple_hydrog/postp \ tools/simple_hydrog/lakes \ - tools/simple_hydrog/rmvpr \ - tools/nc_null_check + tools/simple_hydrog/rmvpr SUBDIRS += man \ tests -if ENABLE_GPU -SUBDIRS += tools/libfrencutils_gpu -SUBDIRS += tools/fregrid_gpu -SUBDIRS += t_gpu -endif - # Shortcut targets to make it easier to run (very) expensive tests. check-expensive: $(MAKE) check RUN_EXPENSIVE_TESTS=yes diff --git a/README.md b/README.md index 1dc2040d..134cc18a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The tools available in FRE-NCtools are: * iceberg_comb -- Combine iceberg history files * combine-ncc -- Combine distributed unstructured FMS grid netCDF files * decompress-ncc -- Convert an unstructured FMS grid file to a standard lat-lon grid -* mppnccombine -- Combine destributed FMS netCDF files +* mppnccombine -- Combine distributed FMS netCDF files * is-compressed -- Determine if a netCDF file has an unstructured FMS grid * scatter-ncc -- Distribute an unstructured FMS grid netCDF file for initializing a FMS climate model * mppncscatter -- Distribute FMS netCDF file for initializing a FMS climate model @@ -50,16 +50,15 @@ The tools available in FRE-NCtools are: ### Statistical and Informational Tools * list_ncvars -- List the variables in a netCDF file -* plevel -- Interpolates data from model levels to pressure levels -* split_ncvars -- Write the variables in a FMS netCDF file into multiple netCDF files, one file per netCDf field +* plevel.sh -- Interpolates data from model levels to pressure levels +* split_ncvars.pl -- Write the variables in a FMS netCDF file into multiple netCDF files, one file per netCDf field * timavg -- Create a time average netCDF file * ncexists -- Checks for variables and attributes in a netCDF file -* nc_null_check -- Checks to see if the value of the attribute *bounds* of variable *lat* has a null character ### Other Tools There are several tools that have parallel versions and can overcome memory and cpu constrains of the serial -conterpart. E.g. fregrid_parallel reproduces the functionality of fregrid, and among other things it is +counterpart. E.g. fregrid_parallel reproduces the functionality of fregrid, and among other things it is commonly used to generate the remapping weights for high resolution grids. (for further information, see the "extreme fregrid" document). The [Ocean Model Grid Generator](https://github.com/NOAA-GFDL/ocean_model_grid_generator) can be copied or @@ -168,7 +167,7 @@ parallel running versions of certain FRE-NCtools applications. ### OpenACC-enabled NCTools applications The option `--enable-acc=yes` to the `configure` command will configure for building the fregrid_acc executable that is capable of offloading computation to GPUs. Currently, only -NVDIA compilers are supported to enable OpenACC directives in fregrid_acc and libfrencutils_acc. +NVIDIA compilers are supported to enable OpenACC directives in fregrid_acc and libfrencutils_acc. Please ensure that `FC=nvfortran` and `CC=nvc`. ## Building on a GFDL-managed system @@ -179,7 +178,7 @@ For example: ``` # Note: env.sh builds a set of commands to configure the environment. -# The backquotes (not single quotes!) do command substitution, using the +# The back quotes (not single quotes!) do command substitution, using the # standard output of env.sh as input to "eval". eval then executes the # set of environment-setting shell commands. eval `site-configs//env.sh` diff --git a/configure.ac b/configure.ac index 3fb299ab..fd95020d 100644 --- a/configure.ac +++ b/configure.ac @@ -199,6 +199,12 @@ AX_LIB_NETCDFF() if test "$with_netcdf_fortran" = "no"; then AC_MSG_ERROR([Unable to find NetCDF Fortran library.]) fi + +# Check if using an external libFMS library +GX_LIB_FMS() +AS_IF([test "$with_fms" = "no"], [ +AC_MSG_NOTICE([Using the FRE-NCtools libfmslite])]) +AM_CONDITIONAL([WITHOUT_EXTERN_FMS], [test "$with_fms" = "no"]) AC_LANG_POP([Fortran]) # Check if Linux sched_getaffinity is available @@ -233,6 +239,7 @@ AC_DEFINE([COPYRIGHT_YEAR], ["copyright_year"], [Year to place in Copyright notices printed with --version information])dnl AC_SUBST(COPYRIGHT_YEAR)dnl +# cspell:ignore RPDIR RPATHFLAGS # Code for setting rpath based ncview's configure.in code. AS_IF([test x$ac_compiler_gnu = xyes], [RPATH_FLAGS="" for word in $NETCDF_LDFLAGS $NETCDF_FCLDFLAGS @@ -253,41 +260,14 @@ AC_SUBST(RPATH_FLAGS) dnl # Output files AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile - lib/libnfu/Makefile + lib/Makefile man/Makefile src/Makefile tests/Makefile - tools/libfrencutils/Makefile - tools/libfrencutils_gpu/Makefile - tools/check_mask/Makefile - tools/cubic_utils/Makefile - tools/fregrid/Makefile - tools/fregrid_gpu/Makefile - tools/make_coupler_mosaic/Makefile - tools/make_hgrid/Makefile - tools/make_land_domain/Makefile - tools/make_quick_mosaic/Makefile - tools/make_regional_mosaic/Makefile - tools/make_solo_mosaic/Makefile - tools/make_topog/Makefile - tools/make_vgrid/Makefile - tools/mppncscatter/Makefile - tools/ncexists/Makefile - tools/nc_null_check/Makefile - tools/remap_land/Makefile - tools/river_regrid/Makefile - tools/runoff_regrid/Makefile - tools/transfer_to_mosaic_grid/Makefile tools/simple_hydrog/Makefile tools/simple_hydrog/postp/Makefile tools/simple_hydrog/lakes/Makefile tools/simple_hydrog/rmvpr/Makefile - tools/simple_hydrog/libfmslite/Makefile - t_gpu/Makefile - t_gpu/test_read_remap_file/Makefile - t_gpu/test_get_grid_cell_struct/Makefile - t_gpu/test_get_upbound_nxcells_2dx2d/Makefile - t_gpu/test_get_interp_order1/Makefile ]) AC_OUTPUT diff --git a/tools/fregrid/Makefile.am b/lib/Makefile.am similarity index 55% rename from tools/fregrid/Makefile.am rename to lib/Makefile.am index f022a243..5f769633 100644 --- a/tools/fregrid/Makefile.am +++ b/lib/Makefile.am @@ -17,23 +17,39 @@ # License along with FRE-NCTools. If not, see # . #*********************************************************************** -bin_PROGRAMS = fregrid + +noinst_LIBRARIES = \ + libnfu/libnfu.a \ + libfrencutils/libfrencutils.a + if WITH_MPI - bin_PROGRAMS += fregrid_parallel + noinst_LIBRARIES += \ + libfrencutils/libfrencutils_mpi.a +endif + +if ENABLE_GPU + noinst_LIBRARIES += \ + libfrencutils_gpu/libfrencutils_gpu.a endif -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils $(NETCDF_CFLAGS) +AM_CFLAGS = $(NETCDF_CFLAGS) +AM_FCFLAGS = $(FC_MODOUT)$(@D) $(FC_DEFAULT_REAL_KIND8_FLAG) $(NETCDF_FCFLAGS) LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) -fregrid_SOURCES = bilinear_interp.c \ - bilinear_interp.h \ - conserve_interp.c \ - conserve_interp.h \ - fregrid_util.c \ - fregrid_util.h \ - fregrid.c -fregrid_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a $(LDADD) - -fregrid_parallel_SOURCES = $(fregrid_SOURCES) -fregrid_parallel_CFLAGS = -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS) -fregrid_parallel_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils_mpi.a $(LDADD) $(MPI_CLDFLAGS) +# Items to handle Fortran module files +SUFFIXES = _mod.$(FC_MODEXT) .$(FC_MODEXT) + +.F90_mod.$(FC_MODEXT): + @$(MKDIR_P) $(@D) + $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $(@D)/$(. #*********************************************************************** -check_PROGRAMS = test_get_interp_order1 +libfrencutils_libfrencutils_a_SOURCES = \ + libfrencutils/affinity.c \ + libfrencutils/constant.h \ + libfrencutils/create_xgrid.c \ + libfrencutils/create_xgrid.h \ + libfrencutils/globals.h \ + libfrencutils/gradient_c2l.c \ + libfrencutils/gradient_c2l.h \ + libfrencutils/interp.c \ + libfrencutils/interp.h \ + libfrencutils/mosaic_util.c \ + libfrencutils/mosaic_util.h \ + libfrencutils/mpp_domain.c \ + libfrencutils/mpp_domain.h \ + libfrencutils/mpp_io.c \ + libfrencutils/mpp_io.h \ + libfrencutils/mpp.c \ + libfrencutils/mpp.h \ + libfrencutils/read_mosaic.c \ + libfrencutils/read_mosaic.h \ + libfrencutils/tool_util.c \ + libfrencutils/tool_util.h -AM_CFLAGS = $(NETCDF_CFLAGS) \ - -I$(top_srcdir)/tools/fregrid_gpu \ - -I$(top_srcdir)/tools/libfrencutils \ - -I$(top_srcdir)/tools/libfrencutils_gpu -acc - -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \ - $(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \ - $(top_builddir)/tools/fregrid_gpu/conserve_interp_gpu.o \ - $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a - -test_get_interp_order1_SOURCES = test_get_interp_order1.c - -TESTS = test_get_interp_order1 +libfrencutils_libfrencutils_mpi_a_SOURCES = \ + $(libfrencutils_libfrencutils_a_SOURCES) +libfrencutils_libfrencutils_mpi_a_CFLAGS = \ + -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS) diff --git a/tools/libfrencutils/mosaic_util.c b/lib/libfrencutils/mosaic_util.c similarity index 100% rename from tools/libfrencutils/mosaic_util.c rename to lib/libfrencutils/mosaic_util.c diff --git a/tools/libfrencutils/mosaic_util.h b/lib/libfrencutils/mosaic_util.h similarity index 100% rename from tools/libfrencutils/mosaic_util.h rename to lib/libfrencutils/mosaic_util.h diff --git a/tools/libfrencutils/mpp.c b/lib/libfrencutils/mpp.c similarity index 100% rename from tools/libfrencutils/mpp.c rename to lib/libfrencutils/mpp.c diff --git a/tools/libfrencutils/mpp.h b/lib/libfrencutils/mpp.h similarity index 100% rename from tools/libfrencutils/mpp.h rename to lib/libfrencutils/mpp.h diff --git a/tools/libfrencutils/mpp_domain.c b/lib/libfrencutils/mpp_domain.c similarity index 100% rename from tools/libfrencutils/mpp_domain.c rename to lib/libfrencutils/mpp_domain.c diff --git a/tools/libfrencutils/mpp_domain.h b/lib/libfrencutils/mpp_domain.h similarity index 100% rename from tools/libfrencutils/mpp_domain.h rename to lib/libfrencutils/mpp_domain.h diff --git a/tools/libfrencutils/mpp_io.c b/lib/libfrencutils/mpp_io.c similarity index 100% rename from tools/libfrencutils/mpp_io.c rename to lib/libfrencutils/mpp_io.c diff --git a/tools/libfrencutils/mpp_io.h b/lib/libfrencutils/mpp_io.h similarity index 100% rename from tools/libfrencutils/mpp_io.h rename to lib/libfrencutils/mpp_io.h diff --git a/tools/libfrencutils/read_mosaic.c b/lib/libfrencutils/read_mosaic.c similarity index 100% rename from tools/libfrencutils/read_mosaic.c rename to lib/libfrencutils/read_mosaic.c diff --git a/tools/libfrencutils/read_mosaic.h b/lib/libfrencutils/read_mosaic.h similarity index 100% rename from tools/libfrencutils/read_mosaic.h rename to lib/libfrencutils/read_mosaic.h diff --git a/tools/libfrencutils/tool_util.c b/lib/libfrencutils/tool_util.c similarity index 100% rename from tools/libfrencutils/tool_util.c rename to lib/libfrencutils/tool_util.c diff --git a/tools/libfrencutils/tool_util.h b/lib/libfrencutils/tool_util.h similarity index 100% rename from tools/libfrencutils/tool_util.h rename to lib/libfrencutils/tool_util.h diff --git a/tools/libfrencutils_gpu/create_xgrid_gpu.c b/lib/libfrencutils_gpu/create_xgrid_gpu.c similarity index 100% rename from tools/libfrencutils_gpu/create_xgrid_gpu.c rename to lib/libfrencutils_gpu/create_xgrid_gpu.c diff --git a/tools/libfrencutils_gpu/create_xgrid_gpu.h b/lib/libfrencutils_gpu/create_xgrid_gpu.h similarity index 100% rename from tools/libfrencutils_gpu/create_xgrid_gpu.h rename to lib/libfrencutils_gpu/create_xgrid_gpu.h diff --git a/tools/libfrencutils_gpu/create_xgrid_utils_gpu.c b/lib/libfrencutils_gpu/create_xgrid_utils_gpu.c similarity index 100% rename from tools/libfrencutils_gpu/create_xgrid_utils_gpu.c rename to lib/libfrencutils_gpu/create_xgrid_utils_gpu.c diff --git a/tools/libfrencutils_gpu/create_xgrid_utils_gpu.h b/lib/libfrencutils_gpu/create_xgrid_utils_gpu.h similarity index 100% rename from tools/libfrencutils_gpu/create_xgrid_utils_gpu.h rename to lib/libfrencutils_gpu/create_xgrid_utils_gpu.h diff --git a/tools/libfrencutils_gpu/general_utils_gpu.c b/lib/libfrencutils_gpu/general_utils_gpu.c similarity index 100% rename from tools/libfrencutils_gpu/general_utils_gpu.c rename to lib/libfrencutils_gpu/general_utils_gpu.c diff --git a/tools/libfrencutils_gpu/general_utils_gpu.h b/lib/libfrencutils_gpu/general_utils_gpu.h similarity index 100% rename from tools/libfrencutils_gpu/general_utils_gpu.h rename to lib/libfrencutils_gpu/general_utils_gpu.h diff --git a/tools/libfrencutils_gpu/globals_gpu.h b/lib/libfrencutils_gpu/globals_gpu.h similarity index 100% rename from tools/libfrencutils_gpu/globals_gpu.h rename to lib/libfrencutils_gpu/globals_gpu.h diff --git a/lib/libnfu/Makefile.am b/lib/libfrencutils_gpu/local.mk similarity index 67% rename from lib/libnfu/Makefile.am rename to lib/libfrencutils_gpu/local.mk index ad570687..7f02f61f 100644 --- a/lib/libnfu/Makefile.am +++ b/lib/libfrencutils_gpu/local.mk @@ -18,17 +18,13 @@ # . #*********************************************************************** -noinst_LIBRARIES = libnfu.a +libfrencutils_gpu_libfrencutils_gpu_a_SOURCES = \ + libfrencutils_gpu/create_xgrid_gpu.c \ + libfrencutils_gpu/create_xgrid_gpu.h \ + libfrencutils_gpu/create_xgrid_utils_gpu.c \ + libfrencutils_gpu/create_xgrid_utils_gpu.h \ + libfrencutils_gpu/general_utils_gpu.c \ + libfrencutils_gpu/general_utils_gpu.h -AM_FCFLAGS = $(FC_DEFAULT_REAL_KIND8_FLAG) $(NETCDF_FCFLAGS) -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -libnfu_a_SOURCES = nfu.F90 nfu_compress.F90 - -nfu_mod.$(FC_MODEXT): nfu.$(OBJEXT) -nfu_compress_mod.$(FC_MODEXT): nfu_compress.$(OBJEXT) - -nfu_compress.$(OBJEXT): nfu_mod.$(FC_MODEXT) - -clean-local: - $(RM) *.$(FC_MODEXT) +libfrencutils_gpu_libfrencutils_gpu_a_CFLAGS = \ + $(AM_CFLAGS) $(OPENACC_CFLAGS) -I$(top_srcdir)/lib/libfrencutils diff --git a/tools/libfrencutils_gpu/parameters.h b/lib/libfrencutils_gpu/parameters.h similarity index 100% rename from tools/libfrencutils_gpu/parameters.h rename to lib/libfrencutils_gpu/parameters.h diff --git a/t_gpu/Makefile.am b/lib/libnfu/local.mk similarity index 84% rename from t_gpu/Makefile.am rename to lib/libnfu/local.mk index 0c2bb9bf..d18018a2 100644 --- a/t_gpu/Makefile.am +++ b/lib/libnfu/local.mk @@ -18,5 +18,11 @@ # . #*********************************************************************** -SUBDIRS = test_read_remap_file test_get_grid_cell_struct test_get_upbound_nxcells_2dx2d\ - test_get_interp_order1 +libnfu_libnfu_a_SOURCES = \ + libnfu/nfu.F90 \ + libnfu/nfu_compress.F90 + +libnfu/nfu_compress.$(OBJEXT): libnfu/nfu_mod.$(FC_MODEXT) + +clean-local: + $(RM) *.$(FC_MODEXT) diff --git a/m4/ax_lib_netcdf.m4 b/m4/ax_lib_netcdf.m4 index 9827526a..7ecef33d 100644 --- a/m4/ax_lib_netcdf.m4 +++ b/m4/ax_lib_netcdf.m4 @@ -1,3 +1,6 @@ +# cspell:ignore ldflag lnetcdff lnetcdf +# cspell:ignore FCCPPFLAGS FCLDFLAGS +# cspell:ignore xccache # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_lib_netcdf4.html # =========================================================================== @@ -347,7 +350,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [use netcdf])], [AS_VAR_SET([ax_netcdf_mo FCFLAGS=$_ax_fc_lib_netcdf_save_FCFLAGS ]) # Check to see if the F90 bindings are usable in the netcdf library. As we -# already know if the netCDF Fortran library is available, we can shortcircuit +# already know if the netCDF Fortran library is available, we can short circuit # this test using the results above. # Some compilers will not correctly mangle the module routine names unless the # file extension is .f90. We will switch the file extension for this test to diff --git a/m4/gx_lib_fms.m4 b/m4/gx_lib_fms.m4 new file mode 100644 index 00000000..caad21a2 --- /dev/null +++ b/m4/gx_lib_fms.m4 @@ -0,0 +1,110 @@ +#cspell:ignore LIBFMS xyes +# =========================================================================== +# +# SYNOPSIS +# +# GX_LIB_FMS() +# +# DESCRIPTION +# +# This macro checks for the presence of the FMS library. FMS is a Fortran +# library. Thus, this macro runs AC_LANG_ASSERT([Fortran]) to ensure that +# the Fortran compiler has been set. +# +# If the FMS library is found, this macro calls +# +# AC_SUBST([LIBFMS_FCFLAGS]) +# AC_SUBST([LIBFMS_LIBS]) +# +# It also sets +# +# with_fms="yes" +# +# If FMS is disabled or not found, this macro sets +# +# with_fms="no" +# +# Your configuration script can test $with_fms to take any further +# actions. +# +# To use the macro, do the following in "configure.ac" before +# AC_OUTPUT: +# +# GX_LIB_FMS() +# +# LICENSE +# +# Copyright (c) 2025 Seth Underwood +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. This file is +# offered as-is, without any warranty. + +AC_DEFUN([GX_LIB_FMS], [ +AC_LANG_ASSERT([Fortran])dnl +AS_IF([test "x$1" = "required"], +[AS_VAR_SET([default_with_fms], [yes])], +[AS_VAR_SET([default_with_fms], [no])]) + +AC_ARG_WITH([fms], +[AS_HELP_STRING([--with-fms=[yes/no/PATH]], + [Use an external libFMS library, at optional PATH location (default no)])], + [], + [with_fms="$default_with_fms"]) +AS_IF([test "x$with_fms" != "xno"], +[_GX_TEST_LIB_FMS()])dnl +]) + +AC_DEFUN([_GX_TEST_LIB_FMS], [ +# Check if the user supplied a path to the FMS library +AS_IF([test "x$with_fms" != "xyes"], [_gx_lib_fms_prefix="$with_fms"]) +# Set the lib and include paths from the prefix +AS_IF([test ! -z ${_gx_lib_fms_prefix+x}], [ +AS_VAR_SET([_gx_lib_fms_lib], [${_gx_lib_fms_prefix}/lib]) +AS_VAR_SET([_gx_lib_fms_include], [${_gx_lib_fms_prefix}/include])]) + +# Some compilers do not correctly mangle the module routine names +# unless the Fortran file extension is .f90. This is a workaround for +# that issue. The Fortran file extension will be reverted prior to +# returning. +_gx_fc_lib_fms_save_srcext=$ac_ext +AC_FC_SRCEXT([f90]) + +# Check if the FMS Fortran module, and if it usable with the current FC compiler. +AC_CACHE_CHECK([FMS module usability], [gx_cv_fms_mod_check],[ +_gx_fc_lib_fms_save_FCFLAGS="$FCFLAGS" +FCFLAGS="$FCFLAGS -I$_gx_lib_fms_include" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [use fms])], +[AS_VAR_SET([gx_cv_fms_mod_check], [yes])], +[AS_VAR_SET([gx_cv_fms_mod_check], [no])]) +FCFLAGS="$_gx_fc_lib_fms_save_FCFLAGS" +]) +# Check if the FMS library is usable with the current FC compiler. +AC_CACHE_CHECK([FMS library is available], [gx_cv_fms_lib_check],[ +_gx_fc_lib_fms_save_FCFLAGS="$FCFLAGS" +_gx_fc_lib_fms_save_LDFLAGS="$LDFLAGS" +_gx_fc_lib_fms_save_LIBS="$LIBS" +FCFLAGS="$FCFLAGS -I$_gx_lib_fms_include" +LDFLAGS="$LDFLAGS -L$_gx_lib_fms_lib" +LIBS="$LIBS -lFMS" +AC_LINK_IFELSE([AC_LANG_PROGRAM([], [use fms])], +[AS_VAR_SET([gx_cv_fms_lib_check], [yes])], +[AS_VAR_SET([gx_cv_fms_lib_check], [no])]) +FCFLAGS="$_gx_fc_lib_fms_save_FCFLAGS" +LDFLAGS="$_gx_fc_lib_fms_save_LDFLAGS" +LIBS="$_gx_fc_lib_fms_save_LIBS" +]) +# Reset the Fortran file extension +ac_ext=$_gx_fc_lib_fms_save_srcext +# Warn if the user requested FMS, but we were unable to find a working +# library +AS_IF([test "$gx_cv_fms_mod_check" = "no" -o "$gx_cv_fms_lib_check" = "no"], +[AC_MSG_WARN([Unable to find a working FMS library. Please specify --with-fms= where location is the path to the FMS library.]) +with_fms="no"],[ +# Return the variables +with_fms="yes" +AC_SUBST([LIBFMS_FCFLAGS], ["-I$_gx_lib_fms_include"]) +AC_SUBST([LIBFMS_LIBS], ["-L$_gx_lib_fms_lib -lFMS"]) +]) +]) diff --git a/man/Makefile.am b/man/Makefile.am index 72e38103..b29f7eb5 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -27,26 +27,26 @@ EXTRA_DIST = \ is-compressed.txt \ list_ncvars.txt \ list_ncvars.sh.txt \ - list_ncvars.csh.1 \ make_hgrid.txt \ make_vgrid.txt \ make_topog.txt \ - make_topog_parallel.1 \ make_coupler_mosaic.txt \ - make_coupler_mosaic_parallel.1 \ make_quick_mosaic.txt \ make_regional_mosaic.txt \ + make_remap_file.txt \ make_solo_mosaic.txt \ mppnccombine.txt \ mppncscatter.txt \ + ncexists.txt \ plevel_interp.txt \ plevel.sh.txt \ river_regrid.txt \ + remap_land.txt \ scatter-ncc.txt \ split_ncvars.pl.txt \ timavg.txt \ - timavg.csh.1 \ time_average.txt \ + transfer_to_mosaic_grid.txt \ asciidoc.conf # Documentation settings @@ -73,21 +73,26 @@ man_MANS += \ make_coupler_mosaic.1 \ make_quick_mosaic.1 \ make_regional_mosaic.1 \ + make_remap_file.1 \ make_solo_mosaic.1 \ mppnccombine.1 \ mppncscatter.1 \ + ncexists.1 \ plevel_interp.1 \ plevel.sh.1 \ river_regrid.1 \ + remap_land.1 \ scatter-ncc.1 \ split_ncvars.pl.1 \ timavg.1 \ timavg.csh.1 \ - time_average.1 + time_average.1 \ + transfer_to_mosaic_grid.1 if WITH_MPI man_MANS += \ make_coupler_mosaic_parallel.1 \ - make_topog_parallel.1 + make_topog_parallel.1 \ + remap_land_parallel.1 endif endif @@ -102,5 +107,22 @@ endif --asciidoc-opts="-f $(ASCIIDOC_CFG)" \ $< +make_alias_1 = @echo ".so man1/$<" > $@ + +list_ncvars.csh.1: list_ncvars.sh.1 + $(make_alias_1) + +make_coupler_mosaic_parallel.1: make_coupler_mosaic.1 + $(make_alias_1) + +make_topog_parallel.1: make_topog.1 + $(make_alias_1) + +remap_land_parallel.1: remap_land.1 + $(make_alias_1) + +timavg.csh.1: timavg.1 + $(make_alias_1) + clean-local: $(RM) *.1 *.xml diff --git a/man/check_mask.txt b/man/check_mask.txt index 3e84fd38..a3258ba5 100644 --- a/man/check_mask.txt +++ b/man/check_mask.txt @@ -1,3 +1,6 @@ +// These are words to have cspell ignore in this file +// cspell:ignore nobc + check_mask(1) ============= @@ -24,7 +27,7 @@ name is `mask_table.n_mask.layout(1)Xlayout(2)`. The model is expected to read file mask_table if you want to mask out some processors. The ocean model is assumed to be logically rectangular grid and land model could -be multiple tiles grid (like cubic shpere grid with 6 tiles). For land model, +be multiple tiles grid (like cubic sphere grid with 6 tiles). For land model, each processor list has three entries: layout position in x-direction, layout position in y-direction and tile number. For ocean model, each processor list has two entries: layout position in x-direction, layout position in y-direction. @@ -56,7 +59,7 @@ model = land. *--ocean_topog* _topog_file_:: Specify the topography information for ocean mosaic. The field name of the topography is depth_tile# or depth when ntiles = 1, The topography data is -positive down. This option is only for model = ocea.n +positive down. This option is only for model = ocean. *--min_pe* _pe_number_:: Specify the smallest processor count to be checked. @@ -84,7 +87,7 @@ When set, only layouts valid with OBC are shown. *--nobc* _num_open_bc_:: Number of open boundary condition. Its value should be less than MAX_OBC -(current is 4 ). Default vaule is 0 for nobc. +(current is 4 ). Default value is 0. *--direction* _d(1),...,d(nobc)_:: Open boundary direction. Each element value should be west, east, south or diff --git a/man/fregrid.txt b/man/fregrid.txt index 8d0bec5e..206cc558 100644 --- a/man/fregrid.txt +++ b/man/fregrid.txt @@ -1,3 +1,7 @@ +// These are words to have cspell ignore in this file +// cspell:ignore --nlon --nlat --Klevel --Lstep +// cspell:ignore --dst_vgrid --nthreads + fregrid(1) ========== @@ -12,11 +16,12 @@ SYNOPSIS fregrid --input_mosaic input_mosaic --input_file input_file [options] DESCRIPTION +----------- fregrid remaps data (scalar or vector) from an input_mosaic onto an output_mosaic, but the output (or target) grid can also be specified -through the inputs lonBegin, lonEnd, latBegin, latEnd, nlon and nlat. -Currently only T-cell scalar regridding and AGRID vector regridding +through the inputs lonBegin, lonEnd, latBegin, latEnd, nLon and nLat. +Currently only T-cell scalar regridding and A-grid vector regridding (where the vector field is expressed in spherical coordinates) is available. Vector fields can be mapped as vectors only from the cubic grid to the lat-lon grid, and while using bilinear interpolation; but @@ -69,7 +74,7 @@ component of the vector field. Specify the output mosaic information. This file contains list of tile files which specify the grid information for each tile. If -output_mosaic is not specified, nlon and nlat must be specified. +output_mosaic is not specified, nLon and nLat must be specified. *--lonBegin* _decimal_:: @@ -152,8 +157,8 @@ Specify the remapping algorithm to be used. Default is 'conserve_order1'. Currently only 'conserve_order1', 'conserve_order2', 'conserve_order2_monotonic' and 'bilinear' remapping scheme are implemented in this tool. The bilinear scheme can -only be used to remap data from cubic grid to regular latlon grid. -When interp_method is 'bilinear', nlon and nlat must be specified and +only be used to remap data from cubic grid to regular lat-lon grid. +When interp_method is 'bilinear', nLon and nLat must be specified and the output data in y-direction will be located at the center of cell or bound of the cell depending on the setting of y_center. @@ -163,8 +168,8 @@ Specify the test function to be used for testing. *--grid_type* _grid_type_:: -Specify the vector field grid location. default is AGRID and only -AGRID is implemented yet. +Specify the vector field grid location. default is A-grid and only +A-grid is implemented yet. *--symmetry*:: @@ -188,7 +193,7 @@ data from finer grid onto destination grid. *--center_y*:: Output latitude will locate at cell center, i.e., the starting -latitude will be -89 when nlat = 90. when center_y is not set, +latitude will be -89 when nLat = 90. when center_y is not set, starting latitude will be -90. for bilinear interpolation. For conservative interpolation, center_y is assumed. @@ -234,7 +239,7 @@ Default is 0.005. When specified, the dimension and field name for longitude and latitude axis will be 'lon' and 'lat'. 'lon_bnd' and 'lat_bnd' will be longitude and latitude bound name. The dimension of lon_bounds is -(2,nlon) and the dimension of lat_bounds is (2,nlat). +(2,nLon) and the dimension of lat_bounds is (2,nLat). *--associated_file_dir* _dir_:: @@ -277,14 +282,16 @@ $ fregrid --input_mosaic C48_mosaic.nc --input_dir input_dir \ --nlon 144 --nlat 90 ---- +// cspell:ignore extrap vgrid + . Remap data onto cm2m ocean grid with extrapolation and vertical interpolation. + ---- -$ fregrid --input_mosaic levitus_mosaic.nc --input_dir inputdir \ +$ fregrid --input_mosaic levitus_mosaic.nc --input_dir input_dir \ --input_file WOA09_ann_theta.nc --scalar_field POTENTIAL_TEMP \ --output_file WOA09_ann_theta_cm2g_extrap.nc \ --output_mosaic cm2m_ocean_mosaic.nc --extrapolate \ - --dst_vgrid inputdir/cm2m_ocean_vgrid.nc + --dst_vgrid input_dir/cm2m_ocean_vgrid.nc ---- BUGS diff --git a/man/list_ncvars.csh.1 b/man/list_ncvars.csh.1 deleted file mode 100644 index f11e6061..00000000 --- a/man/list_ncvars.csh.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/list_ncvars.sh diff --git a/man/list_ncvars.sh.txt b/man/list_ncvars.sh.txt index f8738162..fd744164 100644 --- a/man/list_ncvars.sh.txt +++ b/man/list_ncvars.sh.txt @@ -14,7 +14,7 @@ DESCRIPTION ----------- list the variables from a set of netCDF files, based on the options provided. Dimension variables are not printed. The record dimension -is not counted towards the dimension rank for non-static varibles. +is not counted towards the dimension rank for non-static variables. Variables that end with "_T1", "_T2", and "_DT", and variables that contain only character arrays are skipped. diff --git a/man/list_ncvars.txt b/man/list_ncvars.txt index c6170732..b9548ce4 100644 --- a/man/list_ncvars.txt +++ b/man/list_ncvars.txt @@ -15,7 +15,7 @@ DESCRIPTION ----------- list the variables from a set of netCDF files, based on the options provided. Dimension variables are not printed. The record dimension -is not counted towards the dimension rank for non-static varibles. +is not counted towards the dimension rank for non-static variables. Variables that end with "_T1", "_T2", and "_DT", and variables that contain only character arrays are skipped. diff --git a/man/make_coupler_mosaic.txt b/man/make_coupler_mosaic.txt index 5eeccc5e..2a42f879 100644 --- a/man/make_coupler_mosaic.txt +++ b/man/make_coupler_mosaic.txt @@ -14,18 +14,19 @@ make_coupler_mosaic --atmos_mosaic _file_name_ --ocean_mosaic _file_name_ --ocea DESCRIPTION ----------- -make_coupler_mosaic generates three exchange grids for the FMS coupler. The -output file includes exchange grid files for fluxes between atmosphere and -surface (sea ice and land), exchange grid files for runoff between land and sea -ice. There might be more than one exchange grid files between two model solo -mosaic because there might be multiple tiles in a solo mosaic. The exchange grid -information is between model grid, not between supergrid. We assume the -refinement ratio between model grid and supergrid is 2. Currently we only output -the exchange grid on T-cell. Besides generating the exchange grid files, -make_coupler_mosaic also generates the coupler mosaic file (the file name will -be mosaic_name.nc) which contains the atmos, land and ocean mosaic path, ocean -mosaic topog path and exchange grid file path. make_coupler_mosaic expects -NetCDF format input. +make_coupler_mosaic generates three exchange grids for the FMS +coupler. The output file includes exchange grid files for fluxes +between atmosphere and surface (sea ice and land), exchange grid files +for runoff between land and sea ice. There might be more than one +exchange grid files between two model solo mosaic because there might +be multiple tiles in a solo mosaic. The exchange grid information is +between model grid, not between super grid. We assume the refinement +ratio between model grid and super grid is 2. Currently we only output +the exchange grid on T-cell. Besides generating the exchange grid +files, make_coupler_mosaic also generates the coupler mosaic file (the +file name will be mosaic_name.nc) which contains the atmos, land and +ocean mosaic path, ocean mosaic topog path and exchange grid file +path. make_coupler_mosaic expects NetCDF format input. OPTIONS ------- diff --git a/man/make_coupler_mosaic_parallel.1 b/man/make_coupler_mosaic_parallel.1 deleted file mode 100644 index 7ca98864..00000000 --- a/man/make_coupler_mosaic_parallel.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/make_coupler_mosaic diff --git a/man/make_hgrid.txt b/man/make_hgrid.txt index 99524df3..c3293293 100644 --- a/man/make_hgrid.txt +++ b/man/make_hgrid.txt @@ -1,3 +1,11 @@ +// Words to ignore with cspell +// cspell:ignore nlat nlon lonlat dlat dlon +// cspell:ignore nxbnds nybnds xbnds ybnds +// cspell:ignore nxbnd nybnd xbnd ybnd +// cspell:ignore nratio +// cspell:ignore MAXBOUNDS +// cspell:ignore istart iend jstart jend + make_hgrid(1) ============= @@ -14,14 +22,14 @@ DESCRIPTION ----------- make_hgrid can generate different types of horizontal grid. The output data is -on a supergrid (model grid size x refinement(=2)). For _cubic_grid_, six grid +on a super grid (model grid size x refinement(=2)). For _cubic_grid_, six grid files which contain the grid information for each tile will be generate, otherwise one file will be generated you can specify the grid type through *--grid_type*. The value of grid_type can be _from_file_, _spectral_grid_, _spherical_grid_, _conformal_cubic_grid_, _gnomonic_ed_ or _simple_cartesian_grid_, with default value _spherical_grid_. *--nlon* and -*--nlat* must be specified to indicate supergrid size (for _cubic_grid_, -*--nlat* is not needed because nlat has the same value as nlon. Besides +*--nlat* must be specified to indicate super grid size (for _cubic_grid_, +*--nlat* is not needed because nlat has the same value as nlon). Besides *--nlon* and *--nlat*, other optional and requirement arguments for each type are: @@ -53,17 +61,17 @@ grid size. number of bounds must be 2 in both and x and y-direction. length. _f_plane_grid_:: -For setting geometric fractors according to f-plane. *--f_plane_latitude* need +For setting geometric factors according to f-plane. *--f_plane_latitude* need to be specified. _beta_plane_grid_:: -For setting geometric fractors according to beta plane. *--f_plane_latitude* +For setting geometric factors according to beta plane. *--f_plane_latitude* need to be specified Two algorithms are provided for creating 'tripolar_grid' and 'regular_lonlat_grid'. Monotonic cubic interpolation and legacy algorithm using cosine function to configure grid cell location. The monotonic cubic -interpolation is developed by Russell Fiedler and the detail of the alrogithm is +interpolation is developed by Russell Fiedler and the detail of the algorithm is explained in https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/moler/interp.pdf. More details of the algorithm is available in @@ -99,7 +107,7 @@ entry are allowed but the number should be less than MAXBOUNDS. Specify number of zonal regions for varying resolution. *--nybnds* _nybnds_:: -Specify number of meridinal regions for varying resolution. +Specify number of meridional regions for varying resolution. *--xbnds* _x(1),...,x(nxbnds)_:: Specify boundaries for defining zonal regions of varying resolution. When @@ -111,11 +119,11 @@ poles. Specify boundaries for defining meridional regions of varying resolution. *--nlon* _nlon(1),...,nlon(nxbnds-1)_:: -Number of model grid points(supergrid) for each zonal regions of varying +Number of model grid points(super grid) for each zonal regions of varying resolution. *--nlat* _nlat(1),...,nlat(nybnds-1)_:: -Number of model grid points(supergid) for each meridinal regions of varying +Number of model grid points(super gid) for each meridional regions of varying resolution. *--dlon* _dlon(1),...,dlon(nxbnds)_:: @@ -129,8 +137,8 @@ Specify latitude for joining spherical and rotated bipolar grid. Default value is 65 degree. *--nratio* _nratio_:: -Speicify the refinement ratio when calculating cell length and area of -supergrid. +Specify the refinement ratio when calculating cell length and area of +super grid. *--simple_dx* _dimple_dx_:: Specify the uniform cell length in x-direction for simple cartesian grid. @@ -160,7 +168,7 @@ following options must be set: *--stretch_factor*, *--target_lon* and *--do_cube_transform*:: Reorient the rotated cubed sphere so that tile 6 has north facing upward, which would make analysis and explaining nest placement much easier. When set the -following must be set: *--stretch_factor*, *--latget_lon*, and *--target_lat*. +following must be set: *--stretch_factor*, *--target_lon*, and *--target_lat*. *--stretch_factor* _factor_:: Stretching factor for the grid. @@ -189,19 +197,19 @@ development. It only needs to be specified when *--nest_grids* is set. *--istart_nest* _istart_nest(1),...,istart_nest(nests-1)_:: Specify the comma-separated list of starting i-direction index(es) of nest -grid(s) in parent tile supergrid (Fortran index). +grid(s) in parent tile super grid (Fortran index). *--iend_nest* _iend_nest(1),...,iend_nest(nests-1)_:: Specify the comma-separated list of ending i-direction index(es) of nest grids -in parent tile supergrid (Fortran index). +in parent tile super grid (Fortran index). *--jstart_nest* _jstart_nest(1),...,jstart_nest(nests-1)_:: Specify the comma-separated list of starting j-direction index(es) of nest grids -in parent tile supergrid (Fortran index). +in parent tile super grid (Fortran index). *--jend_nest* _jend_nest(1),...,jend_nest(nests-1)_:: Specify the comma-separated list of ending j-direction index(es) of nest grids -in parent tile supergrid (Fortran index). +in parent tile super grid (Fortran index). *--great_circle_algorithm*:: When specified, great_circle_algorithm will be used to compute grid cell area. @@ -214,7 +222,7 @@ _gnomonic_ed_. When specified, will not output length(dx,dy) and angle (angle_dx, angle_dy) *--rotate_poly*:: -Set to calculate polar polygon areas by caculating the area of a copy of the +Set to calculate polar polygon areas by calculating the area of a copy of the polygon, with the copy being rotated far away from the pole. *--verbose*:: @@ -224,7 +232,7 @@ will be silent when there is no error. EXAMPLES -------- -. generating regular lon-lat grid (supergrid size 60x20) +. generating regular lon-lat grid (super grid size 60x20) + ---- $ make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2 \ @@ -250,7 +258,7 @@ $ make_hgrid --grid_type tripolar_grid --nxbnd 2 --nybnd 7 \ --grid_name om3_grid --center c_cell ---- -. generating simple cartesian grid(supergrid size 20x20) +. generating simple cartesian grid(super grid size 20x20) + ---- $ make_hgrid --grid_type simple_cartesian_grid --xbnd 0,30 \ @@ -258,7 +266,7 @@ $ make_hgrid --grid_type simple_cartesian_grid --xbnd 0,30 \ --simple_dy 1000 ---- -. generating conformal cubic grid. (supergrid size 60x60 for each tile) +. generating conformal cubic grid. (super grid size 60x60 for each tile) + ---- $ make_hgrid --grid_type conformal_cubic_grid --nlon 60 --nratio 2 @@ -287,7 +295,7 @@ $ make_hgrid --grid_type gnomonic_ed --nlon 192 --do_schmidt \ --iend_nest 42,82 --jend_nest 42,82 --halo 3 ---- -. generating spectral grid. (supergrid size 128x64) +. generating spectral grid. (super grid size 128x64) + ---- $ make_hgrid --grid_type spectral_grid --nlon 128 --nlat 64 @@ -301,9 +309,9 @@ $ make_hgrid --grid_type from_file --my_grid_file my_grid_file \ ---- + *Contents of sample my_grid_file*. The first line of my_grid_file will be text ( -will be ignored) followed by nlon+1 lines of real value of x-direction supergrid +will be ignored) followed by nlon+1 lines of real value of x-direction super grid bound location. Then another line of text ( will be ignored), followed by nlat+1 -lines of real value of y-direction supergrid bound location. For example: +lines of real value of y-direction super grid bound location. For example: + ---- x-grid @@ -365,6 +373,7 @@ differ by more than 1 part in 10E6 SEE ALSO -------- +//cspell:disable-next-line *make_vgrid*(1), *make_topo*(1) BUGS diff --git a/man/make_land_domain.txt b/man/make_land_domain.txt new file mode 100644 index 00000000..9bb35b44 --- /dev/null +++ b/man/make_land_domain.txt @@ -0,0 +1,56 @@ +make_land_domain(1) +=================== + +NAME +---- + +make_land_domain - Create a land domain NetCDF file from a coupled mosaic file + +SYNOPSIS +-------- +[verse] +make_land_domain --grid_file grid_file --land_restart land_restart [--output_file output_file] + +DESCRIPTION +----------- + +make_land_domain prepares data to be used in unstructured grid land model domain +decomposition. + +OPTIONS +------- + +*--grid_file* _grid_file_:: + +Coupled mosaic file name + +*--land_restart* _land_restart_:: + +Specify the source file of land restart file. The file name should not contain +the tile# and normally in the for 'land.res' + +*--output_file* _output_file_:: + +Specify the output file name. The default value is 'land_domain.nc'. + +BUGS +---- +Open bug reports at {package_bugreport}. + +AUTHORS +------- +Zhi Liang + +COPYRIGHT AND LICENSE +--------------------- +Copyright {copyright_year} Geophysical Fluid Dynamics Laboratory + +FRE-NCTools is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +FRE-NCTools is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. diff --git a/man/make_quick_mosaic.txt b/man/make_quick_mosaic.txt index 11ff78e1..e81fa924 100644 --- a/man/make_quick_mosaic.txt +++ b/man/make_quick_mosaic.txt @@ -4,7 +4,7 @@ make_quick_mosaic(1) NAME ---- -make_quick_mosaic - Generate a completel FMS coupled grid +make_quick_mosaic - Generate a complete FMS coupled grid SYNOPSIS -------- diff --git a/man/make_regional_mosaic.txt b/man/make_regional_mosaic.txt index 3cfb5d88..ae23b7c1 100644 --- a/man/make_regional_mosaic.txt +++ b/man/make_regional_mosaic.txt @@ -36,12 +36,12 @@ EXAMPLES Generate a regional grid for tile 1 (_regional_grid.tile1.nc_), and the regional mosaic file (_regional_mosaic.nc_). - +// cspell:disable ---- $ make_regional_mosaic --global_mosaic C48_mosaic.nc \ --regional_file rregionatmos_4xdaily.tile1.nc ---- - +//cspell:enable BUGS ---- Open bug reports at {package_bugreport}. diff --git a/man/make_remap_file.txt b/man/make_remap_file.txt new file mode 100644 index 00000000..95e09954 --- /dev/null +++ b/man/make_remap_file.txt @@ -0,0 +1,88 @@ +// Ignore these words with cspell +// cspell:ignore nlon nlat + +make_remap_file(1) +================== + +NAME +---- + +make_remap_file - create cubic sphere grid remap file + +SYNOPSIS +-------- +[verse] + +make_remap_file --input_mosaic _input_mosaic_ --output_mosaic _output_mosaic_ + --remap_file _remap_file_ [--interp_method _method_] + +DESCRIPTION +----------- + +make_remap_file creates a remap file from cubic sphere grid to cubic +sphere grid. The ratio of grid size of input and output grid must be +integer. The purpose of this tool is to create remap file on single +processor for very high resolution grid (It will large processor count +and long time to create such file). Currently this tool can only remap +file for data on grid cell center. + +OPTIONS +------- + +*--input_mosaic* _input_mosaic_:: + +Specify the input mosaic information. This file contains list of tile files +which specify the grid information for each tile. + +*--output_mosaic* _output_mosaic_:: + +Specify the output mosaic information. This file contains list of tile files +which specify the grid information for each tile. If output_mosaic is not +specified, nlon and nlat must be specified. + +*--remap_file* _remap_file_:: + +Specify the file name that saves remapping information. If remap_file is +specified and the file does not exist, remapping information will be calculated +ans stored in remap_file. If remap_file is specified and the file exists, +remapping information will be read from remap_file. + +*--interp_method* _interp_method_:: + +Specify the remapping algorithm to be used. Default is 'conserve_order1'. +Currently only 'conserve_order1', 'conserve_order2' remapping scheme are +implemented in this tool. + +EXAMPLES +-------- + +Remap scalar and vector data onto different grid resolutions + +---- +$ make_remap_file --input_mosaic C3072_mosaic.nc \ + --output_mosaic C6144_mosaic.nc + --remap_file remap_C3072_to_C6144.nc \ + --interp_method conserve_order2fregrid +---- + +BUGS +---- +Open bug reports at {package_bugreport}. + +AUTHORS +------- +Zhi Liang + +COPYRIGHT AND LICENSE +--------------------- +Copyright {copyright_year} Geophysical Fluid Dynamics Laboratory + +FRE-NCTools is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +FRE-NCTools is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. diff --git a/man/make_solo_mosaic.txt b/man/make_solo_mosaic.txt index 1b085680..8041fd5d 100644 --- a/man/make_solo_mosaic.txt +++ b/man/make_solo_mosaic.txt @@ -1,3 +1,6 @@ +// Ignore these words with cspell +// cspell:ignore periodx periody + make_solo_mosaic(1) =================== diff --git a/man/make_topog.txt b/man/make_topog.txt index 86c558de..b0db513a 100644 --- a/man/make_topog.txt +++ b/man/make_topog.txt @@ -1,3 +1,8 @@ +// Ignore these words with cspell +// cspell:ignore topo +// cspell:ignore --dont --dont_change_landmask +// cspell:ignore ieast jeast iwest jwest + make_topog(1) ============= @@ -18,7 +23,7 @@ make_topog can generate topography for any mosaic. The output file will contains the topography for each tile in the mosaic. The field name in the output topography file will be _depth_tile#_ and it is positive down. The topography data will be defined on model grid, the model grid size will be -supergrid grid size divided by refinement (x_refine, y_refine, default is 2). +super grid grid size divided by refinement (x_refine, y_refine, default is 2). *--mosaic* is a required option and all other options are optional, but some options are required depending on the choice of topog_type. Below specify the option (required or non-required) needed for every kind @@ -37,7 +42,7 @@ Remap the topography onto the current grid from some source data file. _rectangular_basin_:: -Constructing a rectangular basin with a flat bottom. *--bottome_depth* are +Constructing a rectangular basin with a flat bottom. *--bottom_depth* are optional arguments. Set bottom_depth to 0 to get all land topography. _gaussian_:: @@ -57,7 +62,7 @@ Generates an idealized not very realistic topography. *--bottom_depth*, _box_channel_:: -Generate a box_channel topography. The interiol of the grid box is a flot +Generate a box_channel topography. The integral of the grid box is a float bottom. The boundary of the grid box is land except points [jwest_south:jwest_north] and [ieast_south:ieast_north]. *--jwest_south*, *--jwest_north*, *--ieast_south* and *--ieast_north* need to be specified. @@ -81,15 +86,15 @@ Specify type of topography. Its value can be _realistic_, _rectangular_basin_, _gaussian_, _bowl_ or _idealized_. The default value is _realistic_. *--x_refine* _refinement_:: -Specify the refinement ratio of model grid vs supergrid ins x-direction. default +Specify the refinement ratio of model grid vs super grid ins x-direction. default value 2. *--y_refine* _refinement_:: -Specify the refinement ratio of model grid vs supergrid ins y-direction. default +Specify the refinement ratio of model grid vs super grid ins y-direction. default value 2. *--topog_file* _topog_file_:: -Specify name of topograhy file (e.g. scripps, navy_topo, ...) +Specify name of topography file (e.g. scripps, navy_topo, ...) *--topog_field* _topog_field_:: Specify name of topography field name in topog_file. @@ -112,7 +117,7 @@ Specify height of gaussian bump as percentage of ocean depth. default value is 0.5. *--gauss_scale* _width_:: -Specify width of gaussian bump as percentag e of basin width. Default value is +Specify width of gaussian bump as percentage e of basin width. Default value is 0.25. *--slope_x* _slope_:: @@ -123,16 +128,16 @@ is 0. Specify rise of the ocean floor to the north for the gaussian bump. Default value is 0. -*--bowl_south* _boundry_:: +*--bowl_south* _boundary_:: Specify southern boundary of Winton bowl. Default value is 60. -*--bowl_north* _boundry_:: +*--bowl_north* _boundary_:: Specify northern boundary of Winton bowl. Default value is 70. -*--bowl_west* _boundry_:: +*--bowl_west* _boundary_:: Specify western boundary of Winton bowl. Default value is 0. -*--bowl_east* _boundry_:: +*--bowl_east* _boundary_:: Specify eastern boundary of Winton bowl. Default value is 20. *--fill_first_row*:: @@ -142,7 +147,7 @@ Make first row of ocean model all land points for ice model. Apply filter to topography. *--round_shallow*:: -Make cells land if depth is less than 1/2 mimumim depth, otherwise make ocean. +Make cells land if depth is less than 1/2 minimum depth, otherwise make ocean. *--fill_shallow*:: Make cells less than minimum depth land. @@ -189,7 +194,7 @@ Depth of the embayment. Default=600.0 *--vgrid_file* _vgrid_file_:: Specify the vertical grid file. When vgrid_file is specified, number of levels -will be written out and topography could be ajusted when set +will be written out and topography could be adjusted when set *--dont_adjust_topo* (remove_isolated_cells, restrict_partial_cells and enforce_min_depth) is not set. @@ -259,7 +264,7 @@ $ make_topog --mosaic mosaic.nc --topog_type realistic \ + ---- $ make_topog --mosaic mosaic.nc --topog_type rectangular_basin \ - --bottome_depth 200 + --bottom_depth 200 ---- . Generate 'box_channel' topography (with flat bottom topography 5000 meters). diff --git a/man/make_topog_parallel.1 b/man/make_topog_parallel.1 deleted file mode 100644 index 9fd08fa0..00000000 --- a/man/make_topog_parallel.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/make_topog diff --git a/man/make_vgrid.txt b/man/make_vgrid.txt index 840c4175..ddd0df8b 100644 --- a/man/make_vgrid.txt +++ b/man/make_vgrid.txt @@ -1,10 +1,13 @@ +// Ignore these words with cspell +// cspell:ignore nbnds bnds dbnds + make_vgrid(1) ============= NAME ---- -make_vgrid - make virtical grids for an FMS model +make_vgrid - make vertical grids for an FMS model SYNOPSIS -------- @@ -17,13 +20,13 @@ DESCRIPTION make_vgrid is used to make a vertical grid for an FMS model. It uses a piecewise monotonic shape preserving cubic-spline algorithm to calculate the grid cell location. The output netCDF file contains information on the -supergrid with grid size equal to the model grid size multiplied by a refinement +super grid with grid size equal to the model grid size multiplied by a refinement factor of two. Two algorithms are provided for creating vertical grid: Monotonic cubic interpolation and the legacy algorithm that uses a cosine function to configure grid cell location. The monotonic cubic interpolation is developed by Russell -Fiedler and the detail of the alrogithm is explained in +Fiedler and the detail of the algorithm is explained in https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/moler/interp.pdf. More details of the algorithm is available in @@ -54,7 +57,7 @@ Optional Flags ~~~~~~~~~~~~~~ *--nz* _nz(1),...,nz(nbnds-1)_:: -Number of supergrid points (double number of model grid points) for each +Number of super grid points (double number of model grid points) for each vertical regions of varying resolution. *--dbnds* _dbnds(1),...,dbnds(nbnds)_:: @@ -63,7 +66,7 @@ Nominal resolution of depth regions. *--stretch* _stretch_:: stretching factor for last region. Default is 1 (no stretching) -*--grid_name* _gridname_:: +*--grid_name* _grid_name_:: Specify the grid name. The output grid file name will be grid_name.nc. The default value is vertical_grid. @@ -77,14 +80,14 @@ used in MOM. EXAMPLES -------- -Example 1: Use monotoic cublic spline interpolation +Example 1: Use monotonic cubic spline interpolation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---- $ make_vgrid --nbnds 3 --bnds 10,200,1000 --nz 10,20 ---- -will make a grid file with 60 supergrid cells, 30 model grid cells +will make a grid file with 60 super grid cells, 30 model grid cells with refinement is 2. In order to generate regions of constant resolution the user should specify 3 @@ -111,11 +114,11 @@ Example 2: Use legacy algorithm make_vgrid --nbnds 3 --bnds 0.,220.,5500. --dbnds 10.,10.,367.14286 --center c_cell ---- -Will make a vertical grid similar to GFDL/CM2/ocn w/ 100 supergrid cells. +Will make a vertical grid similar to GFDL/CM2/ocn w/ 100 super grid cells. SEE ALSO -------- -*make_hgrid*(1), *make_topo*(1) +*make_hgrid*(1), *make_topog*(1) BUGS ---- diff --git a/man/mppncscatter.txt b/man/mppncscatter.txt index 23f8f385..8af670b9 100644 --- a/man/mppncscatter.txt +++ b/man/mppncscatter.txt @@ -1,3 +1,6 @@ +// Ignore these words in cspell +// cspell:ignore xdims ydims + mppncscatter(1) =============== diff --git a/man/ncexists.txt b/man/ncexists.txt new file mode 100644 index 00000000..f1ded374 --- /dev/null +++ b/man/ncexists.txt @@ -0,0 +1,69 @@ +ncexists(1) +=========== + +NAME +---- + +ncexists - Check if a NetCDF file has a variable, variable or global attribute + +SYNOPSIS +-------- +[verse] +ncexists -f filename -g global_attribute +ncexists -f filename -v variable [-a attribute] + +DESCRIPTION +----------- + +Check if the given NetCDF file contains the global attribute, if a +variable exists, or if a variable has an attribute defined. + +Prints 1 to stdout if variable or attribute is found, 0 if not found. + +OPTIONS +------- + +*-f*, *--filename" _filename_:: +Path to NetCDF file to check. + +*-v*, *--variable* _variable_:: +Name of the variable to check. + +*-a*, *--attribute* _attribute_:: +Name of the variable attribute to check. The *-v* option must be +specified. + +*-g*, *--global* _attribute_:: +Name of the global attribute to check. This option will supersede the +*-v* and *-a* options. + +*-h*, *--help*:: + +Print the usage message and exit. + + +*-V*, *--version*:: + +Print the version information and exit. + +BUGS +---- +Open bug reports at {package_bugreport}. + +AUTHORS +------- +Miguel Zuniga + +COPYRIGHT AND LICENSE +--------------------- +Copyright {copyright_year} Geophysical Fluid Dynamics Laboratory + +FRE-NCTools is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +FRE-NCTools is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. diff --git a/man/plevel.sh.txt b/man/plevel.sh.txt index a7f71658..44331b53 100644 --- a/man/plevel.sh.txt +++ b/man/plevel.sh.txt @@ -1,3 +1,7 @@ +// Ignore these words in cspell +// cspell:ignore hght sphum zsurf +// cspell:ignore plevel.nc + plevel.sh(1) ============ @@ -43,9 +47,9 @@ printed. *-o* _out_file_:: The output file name. (Default: plevel.nc) -*-p* _plevs_:: +*-p* _pressure_levels_:: A list of output pressure levels in pascals (with no decimal point). -The default is the 17 NCEP reananalysis levels (bottom to top). The +The default is the 17 NCEP reanalysis levels (bottom to top). The list must be in quotes and values must be separated by a space. *-d* _value_:: diff --git a/man/plevel_interp.txt b/man/plevel_interp.txt index 5388f88c..fbecd6a1 100644 --- a/man/plevel_interp.txt +++ b/man/plevel_interp.txt @@ -1,3 +1,9 @@ +// Ignore these words in cspell +// cspell:ignore plev.input.nml +// cspell:ignore MAX_PLEVS +// cspell:ignore mask_extrap +// cspell:ignore hght sphum zsurf + plevel_interp(1) ================ @@ -25,8 +31,8 @@ the output file name, the output pressure levels, and the names of the fields to be interpolated. The input and output files must be specified. The namelist _input_ variables are: -NAMELISTS ---------- +NAMELIST +-------- The _input_ namelist contains the following variables: @@ -82,13 +88,13 @@ Shuffle setting for new variables. -1 means use input file settings. *character(len=4096)* :: _command_line_:: This program is typically called using the plevel.sh script. This variable will hold the string used to launch this program, which is added to the history -attibute of the written NetCDF file. If this variable is empty, then the -namelist options with their values will be added to the history attribte. +attribute of the written NetCDF file. If this variable is empty, then the +namelist options with their values will be added to the history attribute. The namelist _names_ variables are: *character(len=NF90_MAX_NAME)* :: _temp_name_ = 'temp':: -Name of the temperature varuable. +Name of the temperature valuable. *character(len=NF90_MAX_NAME)* :: _sphum_name_ = 'sphum':: Name of the specific humidity variable. @@ -115,11 +121,11 @@ FILES ----- _plev.input.nml_:: -File that contains the _input_ and optional _names_ Fortran namelists. +File that contains the _input_ and optional _names_ Fortran namelist. SEE ALSO -------- -*plevel*(1), *netcdf*(3) +*plevel.sh*(1), *netcdf*(3) BUGS ---- diff --git a/man/remap_land.txt b/man/remap_land.txt new file mode 100644 index 00000000..a0c27c04 --- /dev/null +++ b/man/remap_land.txt @@ -0,0 +1,153 @@ +remap_land(1) +============= + +NAME +---- + +remap_land - remap land restart file from between mosaic grids + +SYNOPSIS +-------- +[verse] +remap_land --src_mosaic src_mosaic --src_restart src_restart + --dst_mosaic dst_mosaic --dst_restart dst_restart + --dst_cold_restart dst_cold_restart + --land_src_restart land_src_restart + --land_dst_cold_restart land_dst_cold_restart + [--remap_file remap_file] [--print_memory] + +DESCRIPTION +----------- + +remap_land remap land restart file from one mosaic grid to another +mosaic grid. + +OPTIONS +------- + +*--src_mosaic* _src_mosaic_:: + +specify the source mosaic information. This file contains list of tile +files which specify the grid information for each tile. + +*dst_mosaic* _dst_mosaic_:: + +specify the destination mosaic information. This file contains list of +tile files which specify the grid information for each tile. + +*src_restart* _src_restart_:: + +specify the source restart file. + +*dst_restart* _dst_restart_:: + +specify the restart file to be generated on destination grid. + +*dst_cold_restart* _file_:: + +specify the cold restart file destination grid. This is the input +file. The dst_cold_restart_file could be obtained by running the +experiment for 1 day with --dst_mosaic using cold restart. + +*file_type* _file_type_:: + +specify file type. Its value could be 'land', 'cana', 'snow', 'glac', +'lake', 'soil' or 'vegn'. when file_type is 'cana' or 'snow', need to +specify --land_src_restart and --land_cold_restart + +*land_src_restart* _file_:: + +specify the source file of land.res.nc. It is required when the +restart file is snow.res or cana.res + +*land_dst_cold_restart* _file_:: + +specify the destination file of land.res.nc. It is required when the +restart file is snow.res or cana.res + +*remap_file* _remap_file_:: + +specify the file name that saves remapping information. If remap_file +is specified and the file does not exist, remapping information will +be calculated and stored in remap_file. If remap_file is specified and +the file exists, remapping information will be read from remap_file. + +*--print_memory*:: + +debug memory usage when it is set + +EXAMPLES +-------- + +In this example, we will remap land restart files from C192 mosaic +onto C384 mosaic. + +. Run model with C384 grid using cold restart for land. This generates +dst_cold_restart files. + +. Create remapping file and remap land.res file. ++ +---- +$ remap_land --file_type land --src_mosaic C192_mosaic.nc \ + --dst_mosaic c384_mosaic.nc --src_restart src_restart/land.res \ + --dst_restart dst_restart/land.res \ + --dst_cold_restart dst_cold_restart/land.res \ + --remap_file remap_file_C192_to_C384 --print_memory +---- + +. Remap soil, snow, cana, glac, lake, vegn1, vegn2. ++ +---- +for type in soil snow cana glac lake vegn1 vegn2 +do + if [ "$type" = "vegn1" -o "$type" = "vegn2" ] + then + filetype='vegn' + else + filetype=$type + fi + remap_land --file_type $filetype --src_mosaic C192_mosaic.nc \ + --dst_mosaic c384_mosaic.nc --src_restart src_restart/$type.res \ + --dst_restart dst_restart/$type.res \ + --dst_cold_restart dst_cold_restart/$type.res \ + --land_src_restart src_restart/land.res \ + --land_cold_restart dst_cold_restart/land.res \ + --remap_file remap_file_C192_to_C384 \ + --print_memory +done +---- + +. Remap static_vegn if needed ++ +---- +$ remap_land --file_type vegn --src_mosaic C192_mosaic.nc \ + --dst_mosaic c384_mosaic.nc --src_restart src_restart/static_vegn \ + --dst_restart dst_restart/static_vegn \ + --dst_cold_restart dst_cold_restart/vegn1.res \ + --land_src_restart src_restart/land.res \ + --land_cold_restart dst_cold_restart/land.res \ + --remap_file remap_file_C192_to_C384 \ + --print_memory +---- + +BUGS +---- +Open bug reports at {package_bugreport}. + +AUTHORS +------- +Zhi Liang + +COPYRIGHT AND LICENSE +--------------------- +Copyright {copyright_year} Geophysical Fluid Dynamics Laboratory + +FRE-NCTools is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +FRE-NCTools is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. diff --git a/man/scatter-ncc.txt b/man/scatter-ncc.txt index 633ed8f3..4c107812 100644 --- a/man/scatter-ncc.txt +++ b/man/scatter-ncc.txt @@ -23,11 +23,11 @@ OPTIONS *-D debug-level*:: Specifies level of debug output verbosity -*-i ndiv_x*:: +*-i n_div_x*:: Specifies number of divisions in x-direction (Same as io_layout(1)) -*-j ndiv_y*:: +*-j n_div_y*:: Specifies number of divisions in y-direction (Same as io_layout(2)) diff --git a/man/split_ncvars.pl.txt b/man/split_ncvars.pl.txt index 84e498d0..c3382425 100644 --- a/man/split_ncvars.pl.txt +++ b/man/split_ncvars.pl.txt @@ -1,3 +1,6 @@ +// Words to ignore in cspell +// cspell:ignore idir odir onefile + split_ncvars.pl(1) ================== @@ -8,7 +11,7 @@ split_ncvars.pl - Extract variables from a netCDF file into their own file SYNOPSIS -------- [verse] -split_ncvars.pl [-d] [-l] [-i _idir_] [-o _odir_] [-f _file_] [-v _vars_] _file_ [_file_ ...] +split_ncvars.pl [-d] [-l] [-i _in_dir_] [-o _out_dir_] [-f _file_] [-v _vars_] _file_ [_file_ ...] DESCRIPTION ----------- diff --git a/man/timavg.csh.1 b/man/timavg.csh.1 deleted file mode 100644 index 90238aa9..00000000 --- a/man/timavg.csh.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/timavg diff --git a/man/timavg.txt b/man/timavg.txt index 91f3eb50..d40b39c9 100644 --- a/man/timavg.txt +++ b/man/timavg.txt @@ -35,7 +35,7 @@ Average time (instead of end time) for t-axis values *-W*:: Suppress warning messages (use with caution). -*-w* _wght_:: +*-w* _weight_:: Minimum fraction of missing data needed for valid data. Defaults to 0.0. *-o* _ofile_:: diff --git a/man/time_average.txt b/man/time_average.txt index 2e8edb14..ca97f383 100644 --- a/man/time_average.txt +++ b/man/time_average.txt @@ -1,3 +1,6 @@ +// Ignore these words in cspell +// cspell:ignore skip_tavg_errors + time_average(1) =============== @@ -13,8 +16,8 @@ _time_average_ reads the variables in a netCDF file, and computes an average of those variables over the time axis. _time_average_ uses a Fortran namelist _input_ to configure the application. -NAMELISTS ---------- +NAMELIST +-------- *character(len=2048)*, dimension(MAX_FILES) :: _file_names_:: Input file names. diff --git a/man/transfer_to_mosaic_grid.txt b/man/transfer_to_mosaic_grid.txt new file mode 100644 index 00000000..47b15307 --- /dev/null +++ b/man/transfer_to_mosaic_grid.txt @@ -0,0 +1,48 @@ +transfer_to_mosaic_grid(1) +========================== + +NAME +---- + +transfer_to_mosaic_grid - transfer old grid files to the current mosaic grid + +SYNOPSIS +-------- +[verse] +transfer_to_mosaic_grid --input_file _input_file_ + +DESCRIPTION +----------- + +Transfers previous version grid file (The grid file has field x_T.y_T +) into a mosaic grid. The input file could be a ocean only grid or a +coupled grid. + +OPTIONS +------- + +*--input_file* _input_file_:: + +The file name of previous version grid. + +BUGS +---- +Open bug reports at {package_bugreport}. + +AUTHORS +------- +Vinod Kumar and Zhi Liang + +COPYRIGHT AND LICENSE +--------------------- +Copyright {copyright_year} Geophysical Fluid Dynamics Laboratory + +FRE-NCTools is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +FRE-NCTools is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. diff --git a/src/Makefile.am b/src/Makefile.am index 2aa22217..da17811b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,9 +6,42 @@ combine_programs = \ mppnccombine \ scatter-ncc +grid_programs = \ + fregrid \ + make_coupler_mosaic \ + make_hgrid \ + make_land_domain \ + make_regional_mosaic \ + make_remap_file \ + make_quick_mosaic \ + make_solo_mosaic \ + make_topog \ + make_vgrid \ + remap_land \ + river_regrid \ + runoff_regrid \ + transfer_to_mosaic_grid + +if WITH_MPI + grid_programs += \ + fregrid_parallel \ + make_coupler_mosaic_parallel \ + make_topog_parallel \ + remap_land_parallel \ + runoff_regrid_parallel +endif + +if ENABLE_GPU + grid_programs += fregrid_gpu +endif + bin_PROGRAMS = \ decompress-ncc \ - $(combine_programs) + check_mask \ + mppncscatter \ + ncexists \ + $(combine_programs) \ + $(grid_programs) bin_SCRIPTS = \ combine_restarts \ @@ -39,14 +72,21 @@ libnctf_a_SOURCES = \ nct_nc_utils.F90 nodist_libnctf_a_SOURCES = \ nct_nc_utils.$(FC_MODEXT) -BUILT_SOURCES += nct_nc_utils.$(FC_MODEXT) +BUILT_SOURCES += \ + nct_nc_utils.$(FC_MODEXT) +nct_nc_utils.o: nct_nc_utils.F90 c_netcdf_ldadds = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) f_netcdf_ldadds = $(NETCDF_FCLDFLAGS) $(NETCDF_FCLIBS) libnctf.a -AM_FCFLAGS = $(FC_MODOUT)$(MODDIR)$(@D) $(FC_DEFAULT_REAL_KIND8_FLAG) $(NETCDF_FCFLAGS) -AM_CFLAGS = $(NETCDF_CFLAGS) -LDADD = libver.a $(NETCDF_LDFLAGS) $(RPATH_FLAGS) +AM_FCFLAGS = $(FC_MODINC)$(@D) $(FC_MODOUT)$(@D)/.mods $(FC_DEFAULT_REAL_KIND8_FLAG) $(NETCDF_FCFLAGS) +AM_CFLAGS = $(NETCDF_CFLAGS) \ + -I$(top_srcdir)/lib/libfrencutils +LDADD = libver.a \ + $(top_builddir)/lib/libfrencutils/libfrencutils.a \ + $(NETCDF_LDFLAGS) \ + $(NETCDF_LIBS) \ + $(RPATH_FLAGS) BUILT_SOURCES += version.inc version.inc: Makefile @@ -102,12 +142,18 @@ do_subst = $(SED) -e 's,[@]prefix[@],$(prefix),g' \ SUFFIXES = _mod.$(FC_MODEXT) .$(FC_MODEXT) .F90_mod.$(FC_MODEXT): - @$(MKDIR_P) $(@D) + @$(MKDIR_P) $(@D)/.mods $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $(@D)/$( plevel.sh @@ -210,7 +256,193 @@ split_ncvars.pl: split_ncvars/split_ncvars.pl.in Makefile $(do_subst) < $(srcdir)/split_ncvars/split_ncvars.pl.in > split_ncvars.pl chmod +x split_ncvars.pl -install-exec-hook: - ln $(DESTDIR)$(bindir)/split_ncvars.pl $(DESTDIR)$(bindir)/split_ncvars -install-data-hook: - ln $(DESTDIR)$(mandir)/man1/split_ncvars.pl.1 $(DESTDIR)$(mandir)/man1/split_ncvars.1 +# ********************************************************* # +# check_mask # +# ********************************************************* # +check_mask_SOURCES = check-mask/check_mask.c + +# ********************************************************* # +# make_remap_file # +# ********************************************************* # +make_remap_file_SOURCES = cubic_utils/make_remap_file.c + +# ********************************************************* # +# fregrid # +# ********************************************************* # +fregrid_SOURCES = \ + fre-grid/bilinear_interp.c \ + fre-grid/bilinear_interp.h \ + fre-grid/conserve_interp.c \ + fre-grid/conserve_interp.h \ + fre-grid/fregrid_util.c \ + fre-grid/fregrid_util.h \ + fre-grid/fregrid.c +fregrid_parallel_CFLAGS = \ + -Duse_libMPI \ + $(AM_CFLAGS) +fregrid_parallel_LDADD = \ + $(top_builddir)/lib/libfrencutils/libfrencutils_mpi.a \ + $(LDADD) \ + $(MPI_CLDFLAGS) +fregrid_parallel_SOURCES = \ + $(fregrid_SOURCES) + +fregrid_gpu_CFLAGS = \ + -I$(top_srcdir)/lib/libfrencutils_gpu \ + $(AM_CFLAGS) \ + $(OPENACC_CFLAGS) + +fregrid_gpu_SOURCES = \ + fregrid-gpu/conserve_interp_gpu.c \ + fregrid-gpu/conserve_interp_gpu.h \ + fregrid-gpu/interp_utils_gpu.c \ + fregrid-gpu/interp_utils_gpu.h \ + fregrid-gpu/fregrid_utils_gpu.c \ + fregrid-gpu/fregrid_utils_gpu.h \ + fregrid-gpu/fregrid_gpu.c + +fregrid_gpu_LDADD = \ + $(top_builddir)/lib/libfrencutils_gpu/libfrencutils_gpu.a \ + $(LDADD) + +# ********************************************************* # +# make_coupler_mosaic # +# ********************************************************* # +make_coupler_mosaic_SOURCES = \ + make-coupler-mosaic/make_coupler_mosaic.c +make_coupler_mosaic_parallel_CFLAGS = \ + -Duse_libMPI \ + $(AM_CFLAGS) +make_coupler_mosaic_parallel_LDADD = \ + $(top_builddir)/lib/libfrencutils/libfrencutils_mpi.a \ + $(LDADD) \ + $(MPI_CLDFLAGS) +make_coupler_mosaic_parallel_SOURCES = \ + $(make_coupler_mosaic_SOURCES) + +# ********************************************************* # +# make_coupler_mosaic # +# ********************************************************* # +make_hgrid_SOURCES = \ + make-hgrid/create_conformal_cubic_grid.c \ + make-hgrid/create_gnomonic_cubic_grid.c \ + make-hgrid/create_grid_from_file.c \ + make-hgrid/create_hgrid.h \ + make-hgrid/create_lonlat_grid.c \ + make-hgrid/make_hgrid.c + +# ********************************************************* # +# make_land_domain # +# ********************************************************* # +make_land_domain_SOURCES = \ + make-land-domain/make_land_domain.c + +# ********************************************************* # +# make_quick_mosaic # +# ********************************************************* # +make_quick_mosaic_SOURCES = \ + make-quick-mosaic/make_quick_mosaic.c + +# ********************************************************* # +# make_regional_mosaic # +# ********************************************************* # +make_regional_mosaic_SOURCES = \ + make-regional-mosaic/make_regional_mosaic.c + +# ********************************************************* # +# make_solo_mosaic # +# ********************************************************* # +make_solo_mosaic_SOURCES = \ + make-solo-mosaic/get_contact.c \ + make-solo-mosaic/get_contact.h \ + make-solo-mosaic/make_solo_mosaic.c + +# ********************************************************* # +# make_topog # +# ********************************************************* # +make_topog_SOURCES = \ + make-topog/topog.c \ + make-topog/topog.h \ + make-topog/make_topog.c +make_topog_parallel_CFLAGS = \ + -Duse_libMPI \ + $(AM_CFLAGS) +make_topog_parallel_LDADD = \ + $(top_builddir)/lib/libfrencutils/libfrencutils_mpi.a \ + $(LDADD) \ + $(MPI_CLDFLAGS) +make_topog_parallel_SOURCES = \ + $(make_topog_SOURCES) + +# ********************************************************* # +# make_vgrid # +# ********************************************************* # +make_vgrid_SOURCES = \ + make-vgrid/create_vgrid.c \ + make-vgrid/create_vgrid.h \ + make-vgrid/make_vgrid.c + +# ********************************************************* # +# mppncscatter # +# ********************************************************* # +mppncscatter_SOURCES = \ + mpp-ncscatter/common.h \ + mpp-ncscatter/main.c \ + mpp-ncscatter/mppncscatter.c \ + mpp-ncscatter/mppncscatter.h \ + mpp-ncscatter/opt.c \ + mpp-ncscatter/opt.h \ + mpp-ncscatter/scatterdim.c \ + mpp-ncscatter/scatterdim.h \ + mpp-ncscatter/strlist.c \ + mpp-ncscatter/strlist.h \ + mpp-ncscatter/util.h \ + mpp-ncscatter/xmalloc.c \ + mpp-ncscatter/xmalloc.h + +# ********************************************************* # +# ncexists # +# ********************************************************* # +ncexists_SOURCES = \ + nc-exists/ncexists.c + +# ********************************************************* # +# remap_land # +# ********************************************************* # +remap_land_SOURCES = \ + remap-land/remap_land.c +remap_land_parallel_SOURCES = \ + $(remap_land_SOURCES) +remap_land_parallel_CFLAGS = \ + -Duse_libMPI \ + $(AM_CFLAGS) +remap_land_parallel_LDADD = \ + $(top_builddir)/lib/libfrencutils/libfrencutils.a \ + $(LDADD) + +# ********************************************************* # +# river_regrid # +# ********************************************************* # +river_regrid_SOURCES = \ + river-regrid/river_regrid.c + +# ********************************************************* # +# runoff_regrid # +# ********************************************************* # +runoff_regrid_SOURCES = \ + runoff-regrid/runoff_regrid.c +runoff_regrid_parallel_SOURCES = \ + $(runoff_regrid_SOURCES) +runoff_regrid_parallel_CFLAGS = \ + -Duse_libMPI \ + $(AM_CFLAGS) +runoff_regrid_parallel_LDADD = \ + $(top_builddir)/lib/libfrencutils/libfrencutils_mpi.a \ + $(LDADD) \ + $(MPI_CLDFLAGS) + +# ********************************************************* # +# transfer_to_mosaic_grid # +# ********************************************************* # +transfer_to_mosaic_grid_SOURCES = \ + transfer-mosaic-grid/transfer_to_mosaic.c diff --git a/tools/check_mask/CHANGELOG b/src/check-mask/CHANGELOG similarity index 100% rename from tools/check_mask/CHANGELOG rename to src/check-mask/CHANGELOG diff --git a/tools/check_mask/check_mask.c b/src/check-mask/check_mask.c similarity index 100% rename from tools/check_mask/check_mask.c rename to src/check-mask/check_mask.c diff --git a/tools/cubic_utils/make_remap_file.c b/src/cubic_utils/make_remap_file.c similarity index 100% rename from tools/cubic_utils/make_remap_file.c rename to src/cubic_utils/make_remap_file.c diff --git a/tools/fregrid/CHANGELOG b/src/fre-grid/CHANGELOG similarity index 100% rename from tools/fregrid/CHANGELOG rename to src/fre-grid/CHANGELOG diff --git a/tools/fregrid/bilinear_interp.c b/src/fre-grid/bilinear_interp.c similarity index 100% rename from tools/fregrid/bilinear_interp.c rename to src/fre-grid/bilinear_interp.c diff --git a/tools/fregrid/bilinear_interp.h b/src/fre-grid/bilinear_interp.h similarity index 100% rename from tools/fregrid/bilinear_interp.h rename to src/fre-grid/bilinear_interp.h diff --git a/tools/fregrid/conserve_interp.c b/src/fre-grid/conserve_interp.c similarity index 100% rename from tools/fregrid/conserve_interp.c rename to src/fre-grid/conserve_interp.c diff --git a/tools/fregrid/conserve_interp.h b/src/fre-grid/conserve_interp.h similarity index 100% rename from tools/fregrid/conserve_interp.h rename to src/fre-grid/conserve_interp.h diff --git a/tools/fregrid/fregrid.c b/src/fre-grid/fregrid.c similarity index 100% rename from tools/fregrid/fregrid.c rename to src/fre-grid/fregrid.c diff --git a/tools/fregrid/fregrid_util.c b/src/fre-grid/fregrid_util.c similarity index 100% rename from tools/fregrid/fregrid_util.c rename to src/fre-grid/fregrid_util.c diff --git a/tools/fregrid/fregrid_util.h b/src/fre-grid/fregrid_util.h similarity index 100% rename from tools/fregrid/fregrid_util.h rename to src/fre-grid/fregrid_util.h diff --git a/tools/fregrid_gpu/conserve_interp_gpu.c b/src/fregrid-gpu/conserve_interp_gpu.c similarity index 100% rename from tools/fregrid_gpu/conserve_interp_gpu.c rename to src/fregrid-gpu/conserve_interp_gpu.c diff --git a/tools/fregrid_gpu/conserve_interp_gpu.h b/src/fregrid-gpu/conserve_interp_gpu.h similarity index 100% rename from tools/fregrid_gpu/conserve_interp_gpu.h rename to src/fregrid-gpu/conserve_interp_gpu.h diff --git a/tools/fregrid_gpu/fregrid_gpu.c b/src/fregrid-gpu/fregrid_gpu.c similarity index 100% rename from tools/fregrid_gpu/fregrid_gpu.c rename to src/fregrid-gpu/fregrid_gpu.c diff --git a/tools/fregrid_gpu/fregrid_utils_gpu.c b/src/fregrid-gpu/fregrid_utils_gpu.c similarity index 100% rename from tools/fregrid_gpu/fregrid_utils_gpu.c rename to src/fregrid-gpu/fregrid_utils_gpu.c diff --git a/tools/fregrid_gpu/fregrid_utils_gpu.h b/src/fregrid-gpu/fregrid_utils_gpu.h similarity index 100% rename from tools/fregrid_gpu/fregrid_utils_gpu.h rename to src/fregrid-gpu/fregrid_utils_gpu.h diff --git a/tools/fregrid_gpu/interp_utils_gpu.c b/src/fregrid-gpu/interp_utils_gpu.c similarity index 100% rename from tools/fregrid_gpu/interp_utils_gpu.c rename to src/fregrid-gpu/interp_utils_gpu.c diff --git a/tools/fregrid_gpu/interp_utils_gpu.h b/src/fregrid-gpu/interp_utils_gpu.h similarity index 100% rename from tools/fregrid_gpu/interp_utils_gpu.h rename to src/fregrid-gpu/interp_utils_gpu.h diff --git a/tools/make_coupler_mosaic/CHANGELOG b/src/make-coupler-mosaic/CHANGELOG similarity index 100% rename from tools/make_coupler_mosaic/CHANGELOG rename to src/make-coupler-mosaic/CHANGELOG diff --git a/tools/make_coupler_mosaic/make_coupler_mosaic.c b/src/make-coupler-mosaic/make_coupler_mosaic.c similarity index 100% rename from tools/make_coupler_mosaic/make_coupler_mosaic.c rename to src/make-coupler-mosaic/make_coupler_mosaic.c diff --git a/tools/make_hgrid/CHANGELOG b/src/make-hgrid/CHANGELOG similarity index 100% rename from tools/make_hgrid/CHANGELOG rename to src/make-hgrid/CHANGELOG diff --git a/tools/make_hgrid/create_conformal_cubic_grid.c b/src/make-hgrid/create_conformal_cubic_grid.c similarity index 100% rename from tools/make_hgrid/create_conformal_cubic_grid.c rename to src/make-hgrid/create_conformal_cubic_grid.c diff --git a/tools/make_hgrid/create_gnomonic_cubic_grid.c b/src/make-hgrid/create_gnomonic_cubic_grid.c similarity index 100% rename from tools/make_hgrid/create_gnomonic_cubic_grid.c rename to src/make-hgrid/create_gnomonic_cubic_grid.c diff --git a/tools/make_hgrid/create_grid_from_file.c b/src/make-hgrid/create_grid_from_file.c similarity index 100% rename from tools/make_hgrid/create_grid_from_file.c rename to src/make-hgrid/create_grid_from_file.c diff --git a/tools/make_hgrid/create_hgrid.h b/src/make-hgrid/create_hgrid.h similarity index 100% rename from tools/make_hgrid/create_hgrid.h rename to src/make-hgrid/create_hgrid.h diff --git a/tools/make_hgrid/create_lonlat_grid.c b/src/make-hgrid/create_lonlat_grid.c similarity index 100% rename from tools/make_hgrid/create_lonlat_grid.c rename to src/make-hgrid/create_lonlat_grid.c diff --git a/tools/make_hgrid/make_hgrid.c b/src/make-hgrid/make_hgrid.c similarity index 100% rename from tools/make_hgrid/make_hgrid.c rename to src/make-hgrid/make_hgrid.c diff --git a/tools/make_land_domain/CHANGELOG b/src/make-land-domain/CHANGELOG similarity index 100% rename from tools/make_land_domain/CHANGELOG rename to src/make-land-domain/CHANGELOG diff --git a/tools/make_land_domain/make_land_domain.c b/src/make-land-domain/make_land_domain.c similarity index 100% rename from tools/make_land_domain/make_land_domain.c rename to src/make-land-domain/make_land_domain.c diff --git a/tools/make_quick_mosaic/CHANGELOG b/src/make-quick-mosaic/CHANGELOG similarity index 100% rename from tools/make_quick_mosaic/CHANGELOG rename to src/make-quick-mosaic/CHANGELOG diff --git a/tools/make_quick_mosaic/make_quick_mosaic.c b/src/make-quick-mosaic/make_quick_mosaic.c similarity index 100% rename from tools/make_quick_mosaic/make_quick_mosaic.c rename to src/make-quick-mosaic/make_quick_mosaic.c diff --git a/tools/make_regional_mosaic/CHANGELOG b/src/make-regional-mosaic/CHANGELOG similarity index 100% rename from tools/make_regional_mosaic/CHANGELOG rename to src/make-regional-mosaic/CHANGELOG diff --git a/tools/make_regional_mosaic/make_regional_mosaic.c b/src/make-regional-mosaic/make_regional_mosaic.c similarity index 100% rename from tools/make_regional_mosaic/make_regional_mosaic.c rename to src/make-regional-mosaic/make_regional_mosaic.c diff --git a/tools/make_solo_mosaic/CHANGELOG b/src/make-solo-mosaic/CHANGELOG similarity index 100% rename from tools/make_solo_mosaic/CHANGELOG rename to src/make-solo-mosaic/CHANGELOG diff --git a/tools/make_solo_mosaic/get_contact.c b/src/make-solo-mosaic/get_contact.c similarity index 100% rename from tools/make_solo_mosaic/get_contact.c rename to src/make-solo-mosaic/get_contact.c diff --git a/tools/make_solo_mosaic/get_contact.h b/src/make-solo-mosaic/get_contact.h similarity index 100% rename from tools/make_solo_mosaic/get_contact.h rename to src/make-solo-mosaic/get_contact.h diff --git a/tools/make_solo_mosaic/make_solo_mosaic.c b/src/make-solo-mosaic/make_solo_mosaic.c similarity index 100% rename from tools/make_solo_mosaic/make_solo_mosaic.c rename to src/make-solo-mosaic/make_solo_mosaic.c diff --git a/tools/make_topog/CHANGELOG b/src/make-topog/CHANGELOG similarity index 100% rename from tools/make_topog/CHANGELOG rename to src/make-topog/CHANGELOG diff --git a/tools/make_topog/make_topog.c b/src/make-topog/make_topog.c similarity index 100% rename from tools/make_topog/make_topog.c rename to src/make-topog/make_topog.c diff --git a/tools/make_topog/topog.c b/src/make-topog/topog.c similarity index 100% rename from tools/make_topog/topog.c rename to src/make-topog/topog.c diff --git a/tools/make_topog/topog.h b/src/make-topog/topog.h similarity index 100% rename from tools/make_topog/topog.h rename to src/make-topog/topog.h diff --git a/tools/make_vgrid/CHANGELOG b/src/make-vgrid/CHANGELOG similarity index 100% rename from tools/make_vgrid/CHANGELOG rename to src/make-vgrid/CHANGELOG diff --git a/tools/make_vgrid/create_vgrid.c b/src/make-vgrid/create_vgrid.c similarity index 100% rename from tools/make_vgrid/create_vgrid.c rename to src/make-vgrid/create_vgrid.c diff --git a/tools/make_vgrid/create_vgrid.h b/src/make-vgrid/create_vgrid.h similarity index 100% rename from tools/make_vgrid/create_vgrid.h rename to src/make-vgrid/create_vgrid.h diff --git a/tools/make_vgrid/make_vgrid.c b/src/make-vgrid/make_vgrid.c similarity index 100% rename from tools/make_vgrid/make_vgrid.c rename to src/make-vgrid/make_vgrid.c diff --git a/src/mpp-nccombine/Makefile.am b/src/mpp-nccombine/Makefile.am deleted file mode 100644 index c16c05d7..00000000 --- a/src/mpp-nccombine/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = mppnccombine - -mppnccombine_SOURCES = mppnccombine.c -mppnccombine_CFLAGS = $(NETCDF_CFLAGS) $(AM_CFLAGS) -mppnccombine_LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) -lm -clean-local: - $(RM) *.mod diff --git a/tools/mppncscatter/CHANGELOG b/src/mpp-ncscatter/CHANGELOG similarity index 100% rename from tools/mppncscatter/CHANGELOG rename to src/mpp-ncscatter/CHANGELOG diff --git a/tools/mppncscatter/common.h b/src/mpp-ncscatter/common.h similarity index 100% rename from tools/mppncscatter/common.h rename to src/mpp-ncscatter/common.h diff --git a/tools/mppncscatter/main.c b/src/mpp-ncscatter/main.c similarity index 100% rename from tools/mppncscatter/main.c rename to src/mpp-ncscatter/main.c diff --git a/tools/mppncscatter/mppncscatter.c b/src/mpp-ncscatter/mppncscatter.c similarity index 100% rename from tools/mppncscatter/mppncscatter.c rename to src/mpp-ncscatter/mppncscatter.c diff --git a/tools/mppncscatter/mppncscatter.h b/src/mpp-ncscatter/mppncscatter.h similarity index 100% rename from tools/mppncscatter/mppncscatter.h rename to src/mpp-ncscatter/mppncscatter.h diff --git a/tools/mppncscatter/opt.c b/src/mpp-ncscatter/opt.c similarity index 100% rename from tools/mppncscatter/opt.c rename to src/mpp-ncscatter/opt.c diff --git a/tools/mppncscatter/opt.h b/src/mpp-ncscatter/opt.h similarity index 100% rename from tools/mppncscatter/opt.h rename to src/mpp-ncscatter/opt.h diff --git a/tools/mppncscatter/scatterdim.c b/src/mpp-ncscatter/scatterdim.c similarity index 100% rename from tools/mppncscatter/scatterdim.c rename to src/mpp-ncscatter/scatterdim.c diff --git a/tools/mppncscatter/scatterdim.h b/src/mpp-ncscatter/scatterdim.h similarity index 100% rename from tools/mppncscatter/scatterdim.h rename to src/mpp-ncscatter/scatterdim.h diff --git a/tools/mppncscatter/strlist.c b/src/mpp-ncscatter/strlist.c similarity index 100% rename from tools/mppncscatter/strlist.c rename to src/mpp-ncscatter/strlist.c diff --git a/tools/mppncscatter/strlist.h b/src/mpp-ncscatter/strlist.h similarity index 100% rename from tools/mppncscatter/strlist.h rename to src/mpp-ncscatter/strlist.h diff --git a/tools/mppncscatter/util.h b/src/mpp-ncscatter/util.h similarity index 100% rename from tools/mppncscatter/util.h rename to src/mpp-ncscatter/util.h diff --git a/tools/mppncscatter/xmalloc.c b/src/mpp-ncscatter/xmalloc.c similarity index 100% rename from tools/mppncscatter/xmalloc.c rename to src/mpp-ncscatter/xmalloc.c diff --git a/tools/mppncscatter/xmalloc.h b/src/mpp-ncscatter/xmalloc.h similarity index 100% rename from tools/mppncscatter/xmalloc.h rename to src/mpp-ncscatter/xmalloc.h diff --git a/tools/ncexists/CHANGELOG b/src/nc-exists/CHANGELOG similarity index 100% rename from tools/ncexists/CHANGELOG rename to src/nc-exists/CHANGELOG diff --git a/src/nc-exists/ncexists.c b/src/nc-exists/ncexists.c new file mode 100644 index 00000000..43869618 --- /dev/null +++ b/src/nc-exists/ncexists.c @@ -0,0 +1,215 @@ +/*********************************************************************** + * GNU Lesser General Public License + * + * This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). + * + * FRE-NCtools is free software: you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FRE-NCTools. If not, see + * . + **********************************************************************/ +/* + Copyright (C) 2011 NOAA Geophysical Fluid Dynamics Lab, Princeton, NJ +*/ +#include +#include +#include +#include +#include +#include +#include +#include "version.h" + +char *program_name = "ncexists"; + +void +usage (int status) +{ + fprintf (stdout, + "Usage: %s -f filename -g global_attribute\n" + " or: %s -f filename -v variable [-a attribute]\n", + program_name, program_name); + fputs ("Prints 1 to stdout if variable or attribute is found, " + "0 if not found.\n", + stdout); + fputs ("\n" + " -f, --filename=FILENAME netCDF file\n" + " -g, --global=ATTRIBUTE global attribute\n" + " -v, --variable=VARIABLE variable\n" + " -a, --attribute=ATTRIBUTE variable attribute\n" + " -h, --help display this help and exit\n" + " -V, --version output version information and exit\n", + stdout); + exit (status); +} + +void +handle_error (int status) +{ + if (status != NC_NOERR) + { + fprintf (stderr, "%s: %s\n", + program_name, nc_strerror (status)); + exit (EXIT_FAILURE); + } +} + +int +main (int argc, char **argv) +{ + int status; + char *filename = NULL; + char *attr = NULL; + char *gattr = NULL; + int ncid; + char *var_name = NULL; + size_t vr_len; + int var_id; + size_t t_len; + int global = 0; + int c; + nc_type vr_type, t_type; + + static struct option const long_options[] = { + {"filename", required_argument, 0, 'f'}, + {"variable", required_argument, 0, 'v'}, + {"attribute", required_argument, 0, 'a'}, + {"global", required_argument, 0, 'g'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'V'}, + {0, 0, 0, 0} + }; + + if (argc == 1) + { + fprintf (stderr, "%s: No arguments specified\n", program_name); + usage (EXIT_FAILURE); + } + else + { + while ((c = getopt_long (argc, argv, + "hVf:v:g:a:", + long_options, NULL)) != -1) + { + switch (c) + { + case 'f': + filename = optarg; + break; + + case 'g': + gattr = optarg; + global = 1; + break; + + case 'v': + var_name = optarg; + break; + + case 'a': + attr = optarg; + break; + + case 'h': + usage (EXIT_SUCCESS); + break; + + case 'V': + print_version (program_name); + exit (EXIT_SUCCESS); + break; + + case '?': + usage(EXIT_FAILURE); + break; + + default: + usage(EXIT_FAILURE); + break; + } + } + + // Ensure the user has specified a filename + if (filename == NULL) + { + fprintf (stderr, "%s: No filename specified\n", + program_name); + usage (EXIT_FAILURE); + } + + // Ensure the user has specified a variable or global attribute + if (var_name == NULL && gattr == NULL) + { + fprintf (stderr, "%s: No variable or global attribute specified\n", + program_name); + exit (EXIT_FAILURE); + } + + // check if the filename exists and is readable + int access_status = access (filename, R_OK); + if (access_status != 0) + { + fprintf (stderr, "%s: %s: %s\n", + program_name, filename, strerror (errno)); + exit (EXIT_FAILURE); + } + + // Open the netCDF file + handle_error (nc_open (filename, NC_NOWRITE, &ncid)); + + if (global == 1) + { + status = nc_inq_att (ncid, NC_GLOBAL, gattr, &t_type, &t_len); + if (status == NC_NOERR) + { + printf ("1\n"); + } + else + { + printf ("0\n"); + } + } + else + { + status = nc_inq_varid (ncid, var_name, &var_id); + if (status == NC_NOERR) + { + if (attr == NULL) + { + printf ("1\n"); + } + else + { + status = nc_inq_att (ncid, var_id, attr, &vr_type, &vr_len); + if (status == NC_NOERR) + { + printf ("1\n"); + } + else + { + printf ("0\n"); + } + } + } + else + { + printf ("0\n"); + } + } + + status = nc_close (ncid); /* close netCDF dataset */ + if (status != NC_NOERR) + handle_error (status); + } + + exit (EXIT_SUCCESS); +} diff --git a/tools/remap_land/CHANGELOG b/src/remap-land/CHANGELOG similarity index 100% rename from tools/remap_land/CHANGELOG rename to src/remap-land/CHANGELOG diff --git a/tools/remap_land/remap_land.c b/src/remap-land/remap_land.c similarity index 100% rename from tools/remap_land/remap_land.c rename to src/remap-land/remap_land.c diff --git a/tools/river_regrid/CHANGELOG b/src/river-regrid/CHANGELOG similarity index 100% rename from tools/river_regrid/CHANGELOG rename to src/river-regrid/CHANGELOG diff --git a/tools/river_regrid/river_regrid.c b/src/river-regrid/river_regrid.c similarity index 100% rename from tools/river_regrid/river_regrid.c rename to src/river-regrid/river_regrid.c diff --git a/tools/runoff_regrid/CHANGELOG b/src/runoff-regrid/CHANGELOG similarity index 100% rename from tools/runoff_regrid/CHANGELOG rename to src/runoff-regrid/CHANGELOG diff --git a/tools/runoff_regrid/runoff_regrid.c b/src/runoff-regrid/runoff_regrid.c similarity index 100% rename from tools/runoff_regrid/runoff_regrid.c rename to src/runoff-regrid/runoff_regrid.c diff --git a/tools/transfer_to_mosaic_grid/CHANGELOG b/src/transfer-mosaic-grid/CHANGELOG similarity index 100% rename from tools/transfer_to_mosaic_grid/CHANGELOG rename to src/transfer-mosaic-grid/CHANGELOG diff --git a/tools/transfer_to_mosaic_grid/transfer_to_mosaic.c b/src/transfer-mosaic-grid/transfer_to_mosaic.c similarity index 100% rename from tools/transfer_to_mosaic_grid/transfer_to_mosaic.c rename to src/transfer-mosaic-grid/transfer_to_mosaic.c diff --git a/t_gpu/test_get_grid_cell_struct/Makefile.am b/t_gpu/test_get_grid_cell_struct/Makefile.am deleted file mode 100644 index ca0dff37..00000000 --- a/t_gpu/test_get_grid_cell_struct/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** - -check_PROGRAMS = test_get_grid_cell_struct - -AM_CFLAGS = $(NETCDF_CFLAGS) \ - -I$(top_srcdir)/tools/fregrid_gpu \ - -I$(top_srcdir)/tools/libfrencutils \ - -I$(top_srcdir)/tools/libfrencutils_gpu -acc - -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \ - $(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \ - $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a - -test_get_grid_cell_struct_SOURCES = test_get_grid_cell_struct.c - -TESTS = test_get_grid_cell_struct diff --git a/t_gpu/test_get_grid_cell_struct/test_get_grid_cell_struct.c b/t_gpu/test_get_grid_cell_struct/test_get_grid_cell_struct.c deleted file mode 100644 index ec609517..00000000 --- a/t_gpu/test_get_grid_cell_struct/test_get_grid_cell_struct.c +++ /dev/null @@ -1,222 +0,0 @@ -/*********************************************************************** - * GNU Lesser General Public License - * - * This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). - * - * FRE-NCtools is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any loner version. - * - * FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FRE-NCTools. If not, see - * . - **********************************************************************/ - -// This test tests the function test_get_grid_cell_struct used in fregrid_gpu. -// Properties of each grid cell in a smple made-up grid with no poles are computed -// on the device. This test ensures that the data transfer between the host and device -// and computations have executed on the device as expected. - -#include -#include -#include -#include "create_xgrid_utils_gpu.h" -#include "interp_utils_gpu.h" -#include "parameters.h" -#include "globals_gpu.h" - -#define NLON 36 // 36 cells in lon direction (36+1 grid points in the lon direction for each lat point) -#define NLAT 4 // 4 cells in lat direction ( 4+1 grid points in the lat direction for each lon point) - -double dlon = 360.0/NLON; -double dlat = 30.0; - -double const tolerance = 1.e-7; - -typedef struct { - double lon_min[NLON*NLAT]; - double lon_max[NLON*NLAT]; - double lat_min[NLON*NLAT]; - double lat_max[NLON*NLAT]; - double lon_cent[NLON*NLAT]; - double *lon_vertices[NLON*NLAT]; - double *lat_vertices[NLON*NLAT]; -} Answers; - -void copy_cell_to_host(Grid_cells_struct_config *grid_cells); -void reset_cell_on_host(Grid_cells_struct_config *grid_cells); -void get_answers(const double *lon, const double *lat, Answers *answers); -void check_answers( const Grid_cells_struct_config *grid_cells, const Answers *answers); -void check_ranswer( const int n, const double *answer, const double *checkme); - -//TODO: test for compute poly_area - -int main(){ - - Answers answers; - Grid_cells_struct_config grid_cells; - Grid_config grid; - - grid.nxc=NLON; - grid.nyc=NLAT; - grid.lonc = (double *)calloc( (NLON+1)*(NLAT+1), sizeof(double) ); - grid.latc = (double *)calloc( (NLON+1)*(NLAT+1), sizeof(double) ); - - // set grid; no poles, do not need to worry about fix_lon - for(int ilat=0 ; ilatlon_vertices[icell] = (double *)calloc(MAX_V, sizeof(double)); - answers->lat_vertices[icell] = (double *)calloc(MAX_V, sizeof(double)); - } - - //get min max avg replaceme lon values of a cell - for(int ilat=0 ; ilatlat_min[icell] = latitude_min; - answers->lat_max[icell] = latitude_max; - answers->lon_min[icell] = (0 + dlon*ilon)* D2R; - answers->lon_max[icell] = (0 + dlon*(ilon+1))* D2R; - answers->lon_cent[icell] = (dlon*ilon+0.5*dlon)* D2R; - } - } - - //get vertices for each cell - for(int ilat=0 ; ilatlat_vertices[icell][0]=answers->lat_min[icell]; - answers->lat_vertices[icell][1]=answers->lat_min[icell]; - answers->lat_vertices[icell][2]=answers->lat_max[icell]; - answers->lat_vertices[icell][3]=answers->lat_max[icell]; - - answers->lon_vertices[icell][0]=answers->lon_min[icell]; - answers->lon_vertices[icell][1]=answers->lon_max[icell]; - answers->lon_vertices[icell][2]=answers->lon_max[icell]; - answers->lon_vertices[icell][3]=answers->lon_min[icell]; - } - } - -} - -void reset_cell_on_host(Grid_cells_struct_config *grid_cells) -{ - - for( int icell=0 ; icelllon_min[icell]=-99.; - grid_cells->lon_max[icell]=-99.; - grid_cells->lat_min[icell]=-99.; - grid_cells->lat_max[icell]=-99.; - grid_cells->lon_cent[icell]=-99.; - grid_cells->nvertices[icell]=-99; - for(int ipt=0 ; iptlon_vertices[icell][ipt]=-99.; - grid_cells->lat_vertices[icell][ipt]=-99.; - } - } - -} - -void copy_cell_to_host(Grid_cells_struct_config *grid_cells) -{ - - int ncell = NLON*NLAT; -#pragma acc exit data copyout( grid_cells->lon_min[:ncell], grid_cells->lon_max[:ncell], \ - grid_cells->lat_min[:ncell], grid_cells->lat_max[:ncell], \ - grid_cells->lon_cent[:ncell], grid_cells->nvertices[:ncell], \ - grid_cells->lon_vertices[:ncell][:MAX_V],\ - grid_cells->lat_vertices[:ncell][:MAX_V]) -} - -void check_answers( const Grid_cells_struct_config *grid_cells, const Answers *answers) -{ - - printf("Checking for nubmer of cell vertices\n"); - for(int i=0 ; invertices[i] != 4 ) { - printf("ERROR element %d: %d vs %d\n", i, grid_cells->nvertices[i], 4); - exit(1); - } - } - - printf("Checking for min longitudinal point for each cell\n"); - check_ranswer(NLON*NLAT, answers->lon_min, grid_cells->lon_min); - - printf("Checking for max longitudinal point for each cell\n"); - check_ranswer(NLON*NLAT, answers->lon_max, grid_cells->lon_max); - - printf("Checking for min latitudinal point for each cell\n"); - check_ranswer(NLON*NLAT, answers->lat_min, grid_cells->lat_min); - - printf("Checking for max latitudinal point for each cell\n"); - check_ranswer(NLON*NLAT, answers->lat_max, grid_cells->lat_max); - - printf("Checking for avg longitudinal point for each cell\n"); - check_ranswer(NLON*NLAT, answers->lon_cent, grid_cells->lon_cent); - - printf("Checking for longitudinal vertices for each cell\n"); - for(int icell=0 ; icelllon_vertices[icell], grid_cells->lon_vertices[icell]); - } - - printf("Checking for latitudinal vertices for each cell\n"); - for(int icell=0 ; icelllat_vertices[icell], grid_cells->lat_vertices[icell]); - } - - -} - -void check_ranswer( const int n, const double *answers, const double *checkme) { - for(int i=0 ; itolerance ) { - printf(" ERROR element %d: %lf vs %lf, difference of %e\n", - i, answers[i], checkme[i], abs(answers[i]-checkme[i])); - exit(1); - } - } -} diff --git a/t_gpu/test_get_interp_order1/test_get_interp_order1.c b/t_gpu/test_get_interp_order1/test_get_interp_order1.c deleted file mode 100644 index 23726eff..00000000 --- a/t_gpu/test_get_interp_order1/test_get_interp_order1.c +++ /dev/null @@ -1,206 +0,0 @@ -/*********************************************************************** - * GNU Lesser General Public License - * - * This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). - * - * FRE-NCtools is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FRE-NCTools. If not, see - * . - **********************************************************************/ - -// This test tests the function create_xgrid_2dx2d_order2_gpu for a simple -// case where the input grid is identical to the output grid. The exchange -// grid is identical to the input/output grid. Only the parent indices corresponding -// to each exchange cell are checked. - -#include -#include -#include -#include "globals_gpu.h" -#include "interp_utils_gpu.h" -#include "conserve_interp_gpu.h" -#include "create_xgrid_utils_gpu.h" -#include "create_xgrid_gpu.h" - -void generate_input_is_same_as_output_grids(Grid_config *input_grid, Grid_config *output_grid, - Interp_per_input_tile *interp_answers); -int run_tests(Grid_config *input_grid, Grid_config *output_grid, - Interp_per_input_tile *interp); -void check_answers(const Interp_per_input_tile *interp_answers, const Interp_per_input_tile *interp); -void check_ianswers(const int n, const int *answers, const int *checkme); - -//TODO: add more complicated tests -int main() -{ - - Grid_config input_grid, output_grid; - Interp_per_input_tile interp_answers, interp; - - printf("CHECKING CASE 1: Input grid = Output_grid\n"); - - // get input_grid and output_grid - generate_input_is_same_as_output_grids(&input_grid, &output_grid, &interp_answers); - - // run create_xgrid order 1 - run_tests(&input_grid, &output_grid, &interp); - - // check answers - check_answers(&interp_answers, &interp); - - //test successful - return 0; - -} - -void generate_input_is_same_as_output_grids(Grid_config *input_grid, Grid_config *output_grid, - Interp_per_input_tile *interp_answers) -{ - - int nlon_cells = 360-1; //[ 0, 1, ... 360] - int nlat_cells = 3-1; //[ -30, 0, 30] - int ncells = nlon_cells * nlat_cells; - int ngridpts = (nlon_cells+1) * (nlat_cells+1); - double dlat = 30.0; - double dlon = 1.0; - - int i=0; - - input_grid->nxc = nlon_cells ; input_grid->nyc = nlat_cells; - output_grid->nxc = nlon_cells ; output_grid->nyc = nlat_cells; - - input_grid->latc = (double *)malloc(ngridpts*sizeof(double)); - input_grid->lonc = (double *)malloc(ngridpts*sizeof(double)); - output_grid->latc = (double *)malloc(ngridpts*sizeof(double)); - output_grid->lonc = (double *)malloc(ngridpts*sizeof(double)); - - for( int ilat=0 ; ilatlatc[i] = latitude; - output_grid->latc[i] = latitude; - input_grid->lonc[i] = (ilon * dlon)*D2R; - output_grid->lonc[i] = (ilon * dlon)*D2R; - i++; - } - } - - //answers - interp_answers->nxcells = ncells; - interp_answers->input_parent_cell_index = (int *)malloc(ncells*sizeof(int)); - interp_answers->output_parent_cell_index = (int *)malloc(ncells*sizeof(int)); - //interp_answers - for(int ij1=0 ; ij1input_parent_cell_index[ij1] = ij1; - interp_answers->output_parent_cell_index[ij1] = ij1; - } - -} - - -void check_answers(const Interp_per_input_tile *interp_answers, const Interp_per_input_tile *interp) -{ - - //reset interp on host to reassure device data is correct - for(int i=0 ; inxcells; i++) { - interp->input_parent_cell_index[i] = -99; - interp->output_parent_cell_index[i] = -99; - } - -#pragma acc update host( interp->nxcells ) - int nxcells = interp->nxcells; - -#pragma acc exit data copyout( interp->input_parent_cell_index[:nxcells],\ - interp->output_parent_cell_index[:nxcells]) - - printf("checking nxcells\n"); - check_ianswers(1, &(interp_answers->nxcells), &interp->nxcells); - - printf("checking input_parent_cell_index\n"); - check_ianswers(nxcells, interp_answers->input_parent_cell_index, interp->input_parent_cell_index); - - printf("checking output_parent_cell_index\n"); - check_ianswers(nxcells, interp_answers->output_parent_cell_index, interp->output_parent_cell_index); - -} - - -int run_tests(Grid_config *input_grid, Grid_config *output_grid, Interp_per_input_tile *interp) -{ - - int nlon_input_cells = input_grid->nxc; - int nlat_input_cells = input_grid->nyc; - int nlon_output_cells = output_grid->nxc; - int nlat_output_cells = output_grid->nyc; - int ncells_input = nlon_input_cells * nlat_input_cells; - int ncells_output = nlon_output_cells * nlat_output_cells; - int ngridpts_input = (nlon_input_cells+1)*(nlat_input_cells+1); - int ngridpts_output = (nlon_output_cells+1)*(nlat_output_cells+1); - - int upbound_nxcells, nxcells, jlat_overlap_starts, jlat_overlap_ends; - int *approx_nxcells_per_ij1, *ij2_start, *ij2_end; - double *input_grid_mask; - Grid_cells_struct_config output_grid_cells; - - //copy grid to device - copy_grid_to_device_gpu(ngridpts_input, input_grid->latc, input_grid->lonc); - copy_grid_to_device_gpu(ngridpts_output, output_grid->latc, output_grid->lonc); - - //get mask to skip input cells in creating interp - get_input_grid_mask_gpu(ncells_input, &input_grid_mask); - - //get output grid cell info - get_grid_cell_struct_gpu(nlon_output_cells, nlat_output_cells, output_grid, &output_grid_cells); - - //get bounding index - get_bounding_indices_gpu(nlon_output_cells, nlat_output_cells, nlon_input_cells, nlat_input_cells, - output_grid->latc, input_grid->latc, &jlat_overlap_starts, &jlat_overlap_ends); - - //malloc and create arrays - create_upbound_nxcells_arrays_on_device_gpu(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end); - - upbound_nxcells = get_upbound_nxcells_2dx2d_gpu(input_grid->nxc, input_grid->nyc, output_grid->nxc, output_grid->nyc, - jlat_overlap_starts, jlat_overlap_ends, - input_grid->lonc, input_grid->latc, - output_grid->lonc, output_grid->latc, - input_grid_mask, &output_grid_cells, - approx_nxcells_per_ij1, ij2_start, ij2_end); - - nxcells = create_xgrid_2dx2d_order1_gpu( nlon_input_cells, nlat_input_cells, - nlon_output_cells, nlat_output_cells, - jlat_overlap_starts, jlat_overlap_ends, - input_grid->lonc, input_grid->latc, - output_grid->lonc, output_grid->latc, - upbound_nxcells, input_grid_mask, &output_grid_cells, - approx_nxcells_per_ij1, ij2_start, ij2_end, - interp); - - free_grid_cell_struct_gpu(ncells_output, &output_grid_cells); - free_upbound_nxcells_arrays_gpu(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end); - free_input_grid_mask_gpu(ncells_input, &input_grid_mask); - - return 0; - -} - - -void check_ianswers( const int n, const int *answers, const int *checkme) -{ - - for(int i=0 ; i. -#*********************************************************************** - -check_PROGRAMS = test_get_upbound_nxcells_2dx2d - -AM_CFLAGS = $(NETCDF_CFLAGS) \ - -I$(top_srcdir)/tools/fregrid_gpu \ - -I$(top_srcdir)/tools/libfrencutils \ - -I$(top_srcdir)/tools/libfrencutils_gpu -acc - -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \ - $(top_builddir)/tools/fregrid_gpu/conserve_interp_gpu.o \ - $(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \ - $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a - -test_get_upbound_nxcells_2dx2d_SOURCES = test_get_upbound_nxcells_2dx2d.c - -TESTS = test_get_upbound_nxcells_2dx2d diff --git a/t_gpu/test_get_upbound_nxcells_2dx2d/test_get_upbound_nxcells_2dx2d.c b/t_gpu/test_get_upbound_nxcells_2dx2d/test_get_upbound_nxcells_2dx2d.c deleted file mode 100644 index 3c12a84e..00000000 --- a/t_gpu/test_get_upbound_nxcells_2dx2d/test_get_upbound_nxcells_2dx2d.c +++ /dev/null @@ -1,390 +0,0 @@ -/*********************************************************************** - * GNU Lesser General Public License - * - * This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). - * - * FRE-NCtools is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FRE-NCTools. If not, see - * . - **********************************************************************/ - -// This test tests the function get_upbound_nxcells_2dx2d that is called -// before create_xgrid_2dx2d_order1 create_xgrid_2dx2d_order2. This function -// computes the upper bound value of nxcells (number of exchange grid cells) -// and the bounding parent cell indices for each each exchange grid cell. -// The test checks to ensure data transferred successfully between the host and device -// and all computations have occured as expected on the device. - -#include -#include -#include -#include "globals_gpu.h" -#include "conserve_interp_gpu.h" -#include "interp_utils_gpu.h" -#include "create_xgrid_utils_gpu.h" -#include "create_xgrid_gpu.h" - -typedef struct { - int ncells_input; - int *approx_nxcells_per_ij1; - int *ij2_start; - int *ij2_end; - int upbound_nxcells; -} Answers; - -void generate_input_is_same_as_output_grids(Grid_config *input_grid, Grid_config *output_grid, Answers *answers); -void generate_two_ouput_cells_per_input_cell(Grid_config *input_grid, Grid_config *output_grid, Answers *answers); -void check_data_on_device(Grid_config *input_grid, Grid_config *output_grid, - int *approx_nxcells_per_ij1, int *ij2_start, int *ij2_end, - Grid_cells_struct_config *output_grid_cells); -int run_tests(Grid_config *input_grid, Grid_config *output_grid, Grid_cells_struct_config *output_grid_cells, - int **approx_nxcells_per_ij1, int **ij2_start, int **ij2_end, int *upbound_nxcells); -void cleanup_test(Answers *answers, Grid_config *input_grid, Grid_config *output_grid, - Grid_cells_struct_config *output_grid_cells, int *approx_nxcells_per_ij1, int *ij2_start, int *ij2_end); -void check_answers(const Answers *answers, int *approx_nxcells_per_ij1, - int *ij2_start, int *ij2_end, const int upbound_nxcells); -void check_ianswers(const int n, const int *answers, const int *checkme); - -//TODO: add more complicated tests - -int main() -{ - - Grid_config input_grid, output_grid; - Grid_cells_struct_config output_grid_cells; - int upbound_nxcells; - int *approx_nxcells_per_ij1, *ij2_start, *ij2_end; - - Answers answers; - - printf("CHECKING CASE 1: Input grid = Output_grid\n"); - - // generate grids - generate_input_is_same_as_output_grids(&input_grid, &output_grid, &answers); - - //run get_upbound_nxcells_2dx2d - run_tests(&input_grid, &output_grid, &output_grid_cells, &approx_nxcells_per_ij1, &ij2_start, &ij2_end, - &upbound_nxcells); - - // check answers - check_answers(&answers, approx_nxcells_per_ij1, ij2_start, ij2_end, upbound_nxcells); - - //cleanup - cleanup_test(&answers, &input_grid, &output_grid, &output_grid_cells, approx_nxcells_per_ij1, - ij2_start, ij2_end); - - // test is a success - return 0; - -} - -void generate_input_is_same_as_output_grids(Grid_config *input_grid, Grid_config *output_grid, Answers *answers) -{ - - int nlon_cells = 360-1; //[ 0, 1, ... 360] - int nlat_cells = 3-1; //[ -30, 0, 30] - int ncells = nlon_cells * nlat_cells; - int ngridpts = (nlon_cells+1) * (nlat_cells+1); - double dlat = 30.0; - double dlon = 1.0; - - int i=0; - - input_grid->nxc = nlon_cells ; input_grid->nyc = nlat_cells; - output_grid->nxc = nlon_cells ; output_grid->nyc = nlat_cells; - - input_grid->latc = (double *)malloc(ngridpts*sizeof(double)); - input_grid->lonc = (double *)malloc(ngridpts*sizeof(double)); - output_grid->latc = (double *)malloc(ngridpts*sizeof(double)); - output_grid->lonc = (double *)malloc(ngridpts*sizeof(double)); - - for( int ilat=0 ; ilatlatc[i] = latitude; - output_grid->latc[i] = latitude; - input_grid->lonc[i] = (ilon * dlon)*D2R; - output_grid->lonc[i] = (ilon * dlon)*D2R; - i++; - } - } - - //answers - answers->ncells_input = ncells; - answers->upbound_nxcells = ncells; - answers->approx_nxcells_per_ij1 = (int *)malloc(ncells*sizeof(int)); - answers->ij2_start = (int *)malloc(ncells*sizeof(int)); - answers->ij2_end = (int *)malloc(ncells*sizeof(int)); - for( int ij1=0 ; ij1approx_nxcells_per_ij1[ij1] = 1; - answers->ij2_start[ij1] = ij1; - answers->ij2_end[ij1] = ij1; - } - -} - -/* -void generate_two_ouput_cells_per_input_cell(Grid_config *input_grid, Grid_config *output_grid, Answers *answers) -{ - - int nlat_input_cells = 2; //[0, 30, 60] - int nlon_input_cells = 180; //[0, 1, 2...180] - - int nlat_output_cells = 2*nlat_input_cells ; //[0, 15, 30, 45, 60] - int nlon_output_cells = 2*nlon_input_cells ; //[0, 0.5, 1..] - - int ncells_input = nlon_input_cells * nlat_input_cells; - int ncells_output = nlon_output_cells * nlat_output_cells; - int ngridpts_input = (nlon_input_cells+1)*(nlat_input_cells+1); - int ngridpts_output = (nlon_output_cells+1)*(nlat_output_cells+1); - - double dlat_input = 30.0; - double dlon_input = 1.0; - double dlat_output = 15.0; - double dlon_output = 0.5; - - int i=0; - - input_grid->nxc = nlon_input_cells ; input_grid->nyc = nlat_input_cells; - output_grid->nxc = nlon_output_cells ; output_grid->nyc = nlat_output_cells; - - input_grid->latc = (double *)malloc(ngridpts_input*sizeof(double)); - input_grid->lonc = (double *)malloc(ngridpts_input*sizeof(double)); - output_grid->latc = (double *)malloc(ngridpts_output*sizeof(double)); - output_grid->lonc = (double *)malloc(ngridpts_output*sizeof(double)); - - //input grid - for( int ilat=0 ; ilatlatc[ilat] = latitude; - input_grid->lonc[ilat] = (ilon * dlon_input)*D2R ; - } - } - - for(int ilat=0 ; ilatlatc[ilat] = latitude; - output_grid->lonc[ilat] = (ilon *dlon_output) * D2R; - } - } - - //answers - answers->ncells_input = ncells_input; - answers->upbound_nxcells = ncells_output; - answers->approx_nxcells_per_ij1 = (int *)malloc(ncells_input*sizeof(int)); - answers->ij2_start = (int *)malloc(ncells_input*sizeof(int)); - answers->ij2_end = (int *)malloc(ncells_input*sizeof(int)); - for( int ilat=0 ; ilatapprox_nxcells_per_ij1[i] = 4; - answers->ij2_start[i] = (ilat*2)*nlon_output_cells + ilon*2; - answers->ij2_end[i] = (2*ilat+1)*nlon_output_cells + ilon*2+1; - i++; - } - } - -} -*/ - -void check_data_on_device( Grid_config *input_grid, Grid_config *output_grid, - int *approx_nxcells_per_ij1, int *ij2_start, int *ij2_end, - Grid_cells_struct_config *output_grid_cells) -{ - - int nlon_input_cells = input_grid->nxc; - int nlat_input_cells = input_grid->nyc; - int nlon_output_cells = output_grid->nxc; - int nlat_output_cells = output_grid->nyc; - - int input_ngridpts = (nlon_input_cells+1)*(nlat_input_cells+1); - int output_ngridpts = (nlon_output_cells+1)*(nlat_output_cells+1); - int input_ncells = nlon_input_cells * nlat_input_cells; - int output_ncells = nlon_output_cells * nlat_output_cells; - - // grid points should be on device. - if(!acc_is_present(input_grid->lonc, input_ngridpts*sizeof(double))) { - printf("INPUT GRID LON COORDINATES NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(input_grid->latc, input_ngridpts*sizeof(double))) { - printf("INPUT GRID LAT COORDINATES NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid->lonc, output_ngridpts*sizeof(double))) { - printf("OUTPUT GRID LON COORDINATES NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid->latc, output_ngridpts*sizeof(double))) { - printf("OUTPUT GRID LAT COORDINATES NOT ON DEVICE!"); exit(1); - } - - - //arrays used by upbound_nxgrid should be on device - if(!acc_is_present(approx_nxcells_per_ij1, input_ncells*sizeof(int))) { - printf("APPROX_NXCELLS_PER_IJ1 NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(ij2_start, input_ncells*sizeof(int))) { - printf("IJ2_START NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(ij2_end, input_ncells*sizeof(int))) { - printf("IJ2_END NOT ON DEVICE!"); exit(1); - } - - //output_grid_cells information should be on device - if(!acc_is_present(output_grid_cells->lon_min, output_ncells*sizeof(double))) { - printf("OUTPUT_GRID_CELLS LON_MIN NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid_cells->lon_max, output_ncells*sizeof(double))) { - printf("OUTPUT_GRID_CELLS LON_MAX NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid_cells->lat_min, output_ncells*sizeof(double))) { - printf("OUTPUT_GRID_CELLS LAT_MIN NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid_cells->lat_max, output_ncells*sizeof(double))) { - printf("OUTPUT_GRID_CELLS LAT_MAX NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid_cells->lon_cent, output_ncells*sizeof(double))) { - printf("OUTPUT_GRID_CELLS LON_CENT NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid_cells->area, output_ncells*sizeof(double))) { - printf("OUTPUT_GRID_CELLS AREA NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid_cells->nvertices, output_ncells*sizeof(int))) { - printf("OUTPUT_GRID_CELLS NVERTICES NOT ON DEVICE!"); exit(1); - } - - for(int icell=0 ; icelllon_vertices[icell], MAX_V*sizeof(double))) { - printf("OUTPUT_GRID_CELLS LON VERTICES NOT ON DEVICE!"); exit(1); - } - if(!acc_is_present(output_grid_cells->lat_vertices[icell], MAX_V*sizeof(double))) { - printf("OUTPUT_GRID_CELLS LAT VERTICES NOT ON DEVICE!"); exit(1); - } - } - -} - -void check_answers(const Answers *answers, int *approx_nxcells_per_ij1, int *ij2_start, - int *ij2_end, const int upbound_nxcells) -{ - - int ncells_input = answers->ncells_input; - - //double checking answers got copied out - for(int icell=0 ; icellupbound_nxcells), &upbound_nxcells); - - printf("checking approx_nxcells_per_ij1\n"); - check_ianswers(ncells_input, answers->approx_nxcells_per_ij1, approx_nxcells_per_ij1); - - printf("checking ij2_start\n"); - check_ianswers(ncells_input, answers->ij2_start, ij2_start); - - printf("checking ij2_end\n"); - check_ianswers(ncells_input, answers->ij2_end, ij2_end); - -} - -int run_tests(Grid_config *input_grid, Grid_config *output_grid, Grid_cells_struct_config *output_grid_cells, - int **approx_nxcells_per_ij1, int **ij2_start, int **ij2_end, int *upbound_nxcells) -{ - - int nlon_input_cells = input_grid->nxc; - int nlat_input_cells = input_grid->nyc; - int nlon_output_cells = output_grid->nxc; - int nlat_output_cells = output_grid->nyc; - int ncells_input = nlon_input_cells * nlat_input_cells; - int ngridpts_input = (nlon_input_cells+1)*(nlat_input_cells+1); - int ngridpts_output = (nlon_output_cells+1)*(nlat_output_cells+1); - - int jlat_overlap_starts, jlat_overlap_ends; - - int *p_approx_nxcells_per_ij1, *p_ij2_start, *p_ij2_end; - double *input_grid_mask; - - //copy grid to device - copy_grid_to_device_gpu(ngridpts_input, input_grid->latc, input_grid->lonc); - copy_grid_to_device_gpu(ngridpts_output, output_grid->latc, output_grid->lonc); - - //get mask to skip input cells in creating xgrid - get_input_grid_mask_gpu(ncells_input, &input_grid_mask); - if( ! acc_is_present(input_grid_mask, ncells_input*sizeof(double)) ) { - printf("INPUT_GRID_MASK IS NOT ON DEVICE!"); exit(1); - } - - //get output grid cell info - get_grid_cell_struct_gpu(nlon_output_cells, nlat_output_cells, output_grid, output_grid_cells); - - //get bounding indices - get_bounding_indices_gpu(nlon_output_cells, nlat_output_cells, nlon_input_cells, nlat_input_cells, - output_grid->latc, input_grid->latc, &jlat_overlap_starts, &jlat_overlap_ends); - if(jlat_overlap_starts != 0) printf("SMETHING IS WRONG WITH JLAT_OVERLAP_STARTS %d\n", jlat_overlap_starts); - if(jlat_overlap_ends != nlat_input_cells-1) // this is what was in the original. - printf("SOMETHING IS WRONG WITH JLAT_OVERLAP_ENDS %d %d\n", jlat_overlap_ends, nlat_input_cells-1); - - //malloc and create arrays - create_upbound_nxcells_arrays_on_device_gpu(ncells_input, &p_approx_nxcells_per_ij1, &p_ij2_start, &p_ij2_end); - - // check to ensure all data have been transferred/created to device - check_data_on_device(input_grid, output_grid, p_approx_nxcells_per_ij1, p_ij2_start, p_ij2_end, - output_grid_cells); - - *upbound_nxcells = get_upbound_nxcells_2dx2d_gpu(input_grid->nxc, input_grid->nyc, output_grid->nxc, output_grid->nyc, - jlat_overlap_starts, jlat_overlap_ends, - input_grid->lonc, input_grid->latc, output_grid->lonc, output_grid->latc, - input_grid_mask, output_grid_cells, - p_approx_nxcells_per_ij1, p_ij2_start, p_ij2_end); - - *approx_nxcells_per_ij1 = p_approx_nxcells_per_ij1; - *ij2_start = p_ij2_start; - *ij2_end = p_ij2_end; - - free_input_grid_mask_gpu(ncells_input, &input_grid_mask); - - return 0; - -} - -void cleanup_test(Answers *answers, Grid_config *input_grid, Grid_config *output_grid, - Grid_cells_struct_config *output_grid_cells, - int *approx_nxcells_per_ij1, int *ij2_start, int *ij2_end) -{ - - int ncells_output = output_grid->nxc * output_grid->nyc; - int ncells_input = input_grid->nxc * input_grid->nyc; - - free_grid_cell_struct_gpu(ncells_output, output_grid_cells); - free_upbound_nxcells_arrays_gpu(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end); - -} - -void check_ianswers( const int n, const int *answers, const int *checkme) -{ - - for(int i=0 ; i. -#*********************************************************************** - -check_PROGRAMS = test_read_remap_file - -AM_CFLAGS = $(NETCDF_CFLAGS) \ - -I$(top_srcdir)/tools/libfrencutils \ - -I$(top_srcdir)/tools/libfrencutils_gpu \ - -I$(top_srcdir)/tools/fregrid_gpu -acc - -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \ - $(top_builddir)/tools/fregrid_gpu/conserve_interp_gpu.o \ - $(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \ - $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a - -test_read_remap_file_SOURCES = test_read_remap_file.c - -TESTS = test_read_remap_file_conserve.sh - -EXTRA_DIST = test_read_remap_file_conserve.sh - - -TESTS_ENVIRONMENT = test_make_remap_file_conserve="$(srcdir)/test_make_remap_file_conserve.py" - -TEST_EXTENSIONS = .sh - -CLEANFILES = *.nc *txt diff --git a/t_gpu/test_read_remap_file/test_make_remap_file_conserve.py b/t_gpu/test_read_remap_file/test_make_remap_file_conserve.py deleted file mode 100755 index 9a948648..00000000 --- a/t_gpu/test_read_remap_file/test_make_remap_file_conserve.py +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env python3 - -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCtools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any loner version. -# -# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -# ********************************************************************** - -# This python script generates made-up remap files for first order -# and second order interpolation scheme where the number -# output grid tile2 = 2. In addition, this script generate answer -# files in ASCII format. - -import xarray as xr -import numpy as np -import random -import sys - -output_grid_ntiles = 2; - -input_grid_ncells_array = [random.randint(100,500), random.randint(100,500)] -output_grid_ncells_array = input_grid_ncells_array - -nxcells_per_output_tile = [ input_grid_ncells_array[i] * output_grid_ncells_array[i] - for i in range(0,output_grid_ntiles) ] -nxcells2_per_output_tile = [ 2*nxcells_per_output_tile[i] for i in range(0,output_grid_ntiles) ] - -interp_method = int(sys.argv[1]) #1 or 2 - -def write_answers(myfile, answer) : - myfile.write(" ".join(answer)) - myfile.write("\n") - - -for otile in (1,output_grid_ntiles) : - - input_grid_ncells, output_grid_ncells = input_grid_ncells_array[otile-1], output_grid_ncells_array[otile-1] - nxcells, nxcells2 = nxcells_per_output_tile[otile-1], nxcells2_per_output_tile[otile-1] - - #tile1 - tile1_data = [ random.randint(1,6) for i in range(1,nxcells+1) ] - tile1_data_attrs = dict(description="made up numbers", - standard_name="tile_number_in_mosaic1") - tile1 = xr.DataArray( data = tile1_data, dims=('ncells'), attrs=tile1_data_attrs ) - - - #tile1_cell - i_in = [ random.randint(1,input_grid_ncells) for i in range(nxcells) ] - j_in = [ random.randint(1,input_grid_ncells) for i in range(nxcells) ] - tile1_cell_data = np.array( [i_in,j_in] ).flatten('F') - tile1_cell_attrs=dict(description="made up numbers", - standard_name="parent_cell_indices_in_mosaic1") - tile1_cell = xr.DataArray( data=tile1_cell_data, dims=('ncells2'), attrs=tile1_cell_attrs ) - - - #tile2_cell - i_out = [ random.randint(1,output_grid_ncells) for i in range(nxcells) ] - j_out = [ random.randint(1,output_grid_ncells) for i in range(nxcells) ] - tile2_cell_data = np.array( [i_out,j_out] ).flatten('F') - tile2_cell_attrs=dict(description="made up numbers", - standard_name="parent_cell_indices_in_mosaic1") - tile2_cell = xr.DataArray( data=tile2_cell_data, - dims=('ncells2'), - attrs=tile2_cell_attrs ) - - - #xgrid_area - xgrid_area_data = np.array([ random.randint(1,10000)+0.1 for i in range(nxcells) ], dtype=np.float64) - xgrid_area_attrs = dict(description="made up numbers", - standard_name="exchange_grid_area", - units="m2" ) - xgrid_area = xr.DataArray( data=xgrid_area_data, dims=('ncells'), attrs=xgrid_area_attrs ) - - - if( interp_method == 2 ) : - #tile1_distance - di_in = np.array([ random.randint(1,10000)+0.2 for i in range(nxcells) ], dtype=np.float64) - dj_in = np.array([ random.randint(1,10000)+0.3 for i in range(nxcells) ], dtype=np.float64) - tile1_distance_data = np.array( [di_in, dj_in] ).flatten('F') - tile1_distance_attrs=dict(description="Made up numbers", - standard_name="distance_from_parent1_cell_centroid") - tile1_distance = xr.DataArray( data=tile1_distance_data, dims=('ncells2'), attrs=tile1_distance_attrs ) - - - #dataset conserve_order1 - data_vars = {"tile1": tile1, "tile1_cell":tile1_cell, "tile2_cell":tile2_cell, "xgrid_area":xgrid_area} - if( interp_method == 2 ) : data_vars["tile1_distance"] = tile1_distance - remap = xr.Dataset(data_vars=data_vars) - #write netcdf file - remap.to_netcdf(f"remap_conserve{interp_method}.tile{otile}.nc", format="NETCDF4_CLASSIC") - - #write out answer file - myfile = open(f"answers_conserve{interp_method}.tile{otile}.txt", 'w') - - #answer for nxcells - write_answers(myfile,[str(nxcells)]) #total_nxcells - write_answers(myfile, [str(tile1_data.count(i)) for i in range(1,7) ]) #nxcells per gridin tile - - #answer for interp[n].per_intile[m].i_in - # -1 to be consistent with zhi.... - for itile in range(1,7) : - answer = [ str(i_in[i]-1) for i in range(nxcells) if tile1_data[i]==itile ] - write_answers(myfile, answer) - - #answer for interp[n].per_intile[m].j_in - # -1 to be consistent with zhi.... - for itile in range(1,7) : - answer = [ str(j_in[i]-1) for i in range(nxcells) if tile1_data[i]==itile ] - write_answers(myfile, answer) - - #answer for interp[n].per_intile[m].i_out - # -1 to be consistent with zhi.... - for itile in range(1,7) : - answer = [ str(i_out[i]-1) for i in range(nxcells) if tile1_data[i]==itile ] - write_answers(myfile, answer) - - #answer for interp[n].per_intile[m].j_out - # -1 to be consistent with zhi.... - for itile in range(1,7) : - answer = [ str(j_out[i]-1) for i in range(nxcells) if tile1_data[i]==itile ] - write_answers(myfile, answer) - - #answer for interp[n].per_intile[m].area - for itile in range(1,7) : - answer = [ str(xgrid_area_data[i]) for i in range(nxcells) if tile1_data[i]==itile ] - write_answers(myfile, answer) - - if( interp_method == 2 ) : - #answer for interp[n].per_intile[m].di_in - for itile in range(1,7) : - answer = [ str(di_in[i]) for i in range(nxcells) if tile1_data[i]==itile ] - write_answers(myfile, answer) - #answer for interp[n].per_intile[m].di_in - for itile in range(1,7) : - answer = [ str(dj_in[i]) for i in range(nxcells) if tile1_data[i]==itile ] - write_answers(myfile, answer) - - myfile.close() diff --git a/t_gpu/test_read_remap_file/test_read_remap_file.c b/t_gpu/test_read_remap_file/test_read_remap_file.c deleted file mode 100644 index b15bc210..00000000 --- a/t_gpu/test_read_remap_file/test_read_remap_file.c +++ /dev/null @@ -1,473 +0,0 @@ -/*********************************************************************** - * GNU Lesser General Public License - * - * This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). - * - * FRE-NCtools is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any loner version. - * - * FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FRE-NCTools. If not, see - * . - **********************************************************************/ - -// This test tests function read_remap_file_gpu to read in a made-up -// remap file. It ensures the correct initialization of the interp_gpu struct. -// The remap file is generated with the python script -// test_make_remap_file_conserve.py that uses the xarray module. This -// test also tests the function copy_interp_to_device_gpu which copies interp_gpu -// to device. - -#include -#include -#include -#include -#include -#include -#include -#include "conserve_interp_gpu.h" -#include "interp_utils_gpu.h" -#include "globals_gpu.h" - -#define INPUT_GRID_NTILES 6 -#define OUTPUT_GRID_NTILES 2 - -double const tolerance = 1.e-7; - -int const input_grid_nlon = 2; -int const output_grid_nlon = 3; - -typedef struct { - char answer_file[15]; - size_t total_nxcells; - int nxcells[INPUT_GRID_NTILES]; - int *input_parent_cell_index[INPUT_GRID_NTILES]; - int *output_parent_cell_index[INPUT_GRID_NTILES]; - double *xcell_area[INPUT_GRID_NTILES]; - double *dcentroid_lon[INPUT_GRID_NTILES]; - double *dcentroid_lat[INPUT_GRID_NTILES]; -} Answers; - -typedef enum { - myCONSERVE_ORDER1, - myCONSERVE_ORDER2 -} myInterp_Method; - -typedef enum { - ON_DEVICE, - ON_HOST -} Where_Am_I; - -char answer_files1[OUTPUT_GRID_NTILES][30] = { "answers_conserve1.tile1.txt", "answers_conserve1.tile2.txt" }; -char answer_files2[OUTPUT_GRID_NTILES][30] = { "answers_conserve2.tile1.txt", "answers_conserve2.tile2.txt" }; - -char remap_files1[OUTPUT_GRID_NTILES][30] = { "remap_conserve1.tile1.nc", "remap_conserve1.tile2.nc" }; -char remap_files2[OUTPUT_GRID_NTILES][30] = { "remap_conserve2.tile1.nc", "remap_conserve2.tile2.nc" }; - -void read_all_answers(Answers *answers, int myinterp_method); -void read_ianswers( FILE *myfile, int *nxcells, int **ianswer); -void read_ranswers( FILE *myfile, int *nxcells, double **ianswer); -void check_answers_on_device(Answers *answers, Interp_config_gpu *interp_gpu, int myinterp_method); -void check_answers_on_host(Answers *answers, Interp_config_gpu *interp_gpu, int myinterp_method); -void reset_interp_gpu_on_host( Interp_config_gpu *interp_gpu, Answers *answers, int myinterp_method ); -void check_ianswers(int n, int *answers, int *checkme, int host_or_device); -void check_ranswers(int n, double *answers, double *checkme, int host_or_device); -void error(char *error_message); - -// start program -int main(int argc, char *argv[]) { - - Interp_config_gpu interp_gpu[OUTPUT_GRID_NTILES]; - Grid_config input_grid[INPUT_GRID_NTILES], output_grid[OUTPUT_GRID_NTILES]; - Answers answers[OUTPUT_GRID_NTILES]; - - unsigned int opcode; - myInterp_Method myinterp_method; - - if( atoi(argv[1]) == 1) { - opcode = CONSERVE_ORDER1; - myinterp_method = myCONSERVE_ORDER1; - } - else if( atoi(argv[1]) == 2 ) { - opcode = CONSERVE_ORDER2; - myinterp_method = myCONSERVE_ORDER2; - } - - // assign number of cells in lon direction to Grid_config - for(int otile=0 ; otile 0 ) error("ERROR with data on device"); - - } - -} -//------------------------------------------ -//------------------------------------------ -void check_ranswers( int n, double *answers, double *checkme, int host_or_device) -{ - - if( host_or_device == ON_HOST ) { - for(int i=0 ; i tolerance ) { - printf("ERROR element %d: %lf vs %lf\n", i, answers[i], checkme[i]); - exit(1); - } - } - } - else { - - int theres_an_error=-99; - - if( !acc_is_present(answers, n*sizeof(int)) ) error("answers are not on device"); - if( !acc_is_present(checkme, n*sizeof(int)) ) error("answers are not on device"); - -#pragma acc data present(answers[:n], checkme[:n]) copy(theres_an_error) -#pragma acc parallel loop independent reduction(+:theres_an_error) - for(int i=0 ; i tolerance ) { - printf("ERROR element %d: %lf vs %lf\n", i, answers[i], checkme[i]); - theres_an_error++; - } - } - if(theres_an_error != -99) error("ERROR with data on device"); - } - -} -//------------------------------------------ -//------------------------------------------ -void error( char *error_message ) -{ - printf("%s\n", error_message); - exit(1); -} diff --git a/t_gpu/test_read_remap_file/test_read_remap_file_conserve.sh b/t_gpu/test_read_remap_file/test_read_remap_file_conserve.sh deleted file mode 100755 index e9ee82d2..00000000 --- a/t_gpu/test_read_remap_file/test_read_remap_file_conserve.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -#*********************************************************************** -#* GNU Lesser General Public License -#* -#* This file is part of the GFDL Flexible Modeling System (FMS). -#* -#* FMS is free software: you can redistribute it and/or modify it under -#* the terms of the GNU Lesser General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or (at -#* your option) any later version. -#* -#* FMS is distributed in the hope that it will be useful, but WITHOUT -#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#* for more details. -#* -#* You should have received a copy of the GNU Lesser General Public -#* License along with FMS. If not, see . -#*********************************************************************** - -#copy python script over -#make cp_test_make_remap_file - -echo -e "\ntest reading remap file for conserve_order1\n" - -${test_make_remap_file_conserve} 1 -./test_read_remap_file 1 - -echo -e "\ntest reading remap file for conserve_order2\n" -${test_make_remap_file_conserve} 2 -./test_read_remap_file 2 diff --git a/tests/Makefile.am b/tests/Makefile.am index 45df573f..f2268f84 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -24,7 +24,7 @@ else skipflag="" endif -AM_CFLAGS = $(NETCDF_CFLAGS) -I$(top_builddir)/src -I$(top_srcdir)/tools/libfrencutils +AM_CFLAGS = $(NETCDF_CFLAGS) -I$(top_builddir)/src -I$(top_srcdir)/lib/libfrencutils AM_FCFLAGS = -I$(top_builddir)/src LDADD = -L$(top_builddir)/src -lver $(NETCDF_LDFLAGS) $(NETCDF_LIBS) @@ -80,6 +80,12 @@ tools_tests = \ make_regional_mosaic/make_regional_mosaic \ make_quick_mosaic/coupled-model-quick \ mppncscatter/xyt-decomp \ + ncexists/a-without-v \ + ncexists/global-attribute \ + ncexists/no-g-or-v \ + ncexists/nofile \ + ncexists/variable \ + ncexists/variable-attribute \ fregrid/cubedsphere \ fregrid/extrapolate \ fregrid/latlon \ @@ -159,6 +165,7 @@ EXTRA_DIST = \ make_hgrid/grid_spec.tile4.ncl \ make_hgrid/grid_spec.tile5.ncl \ make_hgrid/grid_spec.tile6.ncl \ + ncexists/create-test-file.sh \ simple_hydrology/river_regrid \ $(TESTS) diff --git a/tests/ncexists/a-without-v b/tests/ncexists/a-without-v new file mode 100755 index 00000000..0c1f6804 --- /dev/null +++ b/tests/ncexists/a-without-v @@ -0,0 +1,33 @@ +#!/bin/sh + +# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory + +# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). + +# FRE-NCtools is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. + +# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with FRE-NCTools. If not, see +# . + +if test "$VERBOSE" = yes +then + set -x + command -v ncexists + ncexists --version +fi + +. "${srcdir=.}/init.sh" + +$top_srcdir/tests/ncexists/create-test-file.sh || framework_failure_ "Failed to create test file" + +# This test should fail because -v is not specified +ncexists -f test.nc -a dummy_global_att && fail_ ncexists should exit with an error code when -g or -v is not specified || true diff --git a/tests/ncexists/create-test-file.sh b/tests/ncexists/create-test-file.sh new file mode 100755 index 00000000..c4d49032 --- /dev/null +++ b/tests/ncexists/create-test-file.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory + +# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). + +# FRE-NCtools is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. + +# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with FRE-NCTools. If not, see +# . + +# Create the test netCDF file. +ncgen -o test.nc << EOF +netcdf test { +dimensions: + grid_xt = 2 ; + grid_yt = 2 ; + time = UNLIMITED ; // (1 currently) +variables: + double grid_xt(grid_xt) ; + grid_xt:long_name = "T-cell longitude" ; + grid_xt:units = "degrees_E" ; + grid_xt:axis = "X" ; + double grid_yt(grid_yt) ; + grid_yt:long_name = "T-cell latitude" ; + grid_yt:units = "degrees_N" ; + grid_yt:axis = "Y" ; + double time(time) ; + time:long_name = "time" ; + time:units = "days since 0001-01-01 00:00:00" ; + time:axis = "T" ; + time:calendar_type = "NOLEAP" ; + time:calendar = "noleap" ; + float var(grid_yt, grid_xt) ; + var:long_name = "Decomposed variable" ; + var:units = "m" ; + var:missing_value = 1.e+20f ; + var:_FillValue = 1.e+20f ; + var:dummy_attribute = "just a dummy attribute" ; +// global attributed: + :filename = "test.nc" ; + :NumFilesInSet = 2 ; + :dummy_global_att = "a global dummy attribute" ; +data: + grid_xt = 0.0, 1.0 ; + grid_yt = 0.0, 1.0 ; + time = 0 ; + var = + 0, 1, 2, 3 ; +} +EOF + diff --git a/tests/ncexists/global-attribute b/tests/ncexists/global-attribute new file mode 100755 index 00000000..e65b9ea7 --- /dev/null +++ b/tests/ncexists/global-attribute @@ -0,0 +1,33 @@ +#!/bin/sh + +# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory + +# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). + +# FRE-NCtools is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. + +# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with FRE-NCTools. If not, see +# . + +if test "$VERBOSE" = yes +then + set -x + command -v ncexists + ncexists --version +fi + +. "${srcdir=.}/init.sh" + +$top_srcdir/tests/ncexists/create-test-file.sh || framework_failure_ "Failed to create test file" + +test $(ncexists -f test.nc -g dummy_global_att) -eq 1 || fail_ ncexists did not find the global attribute +test $(ncexists -f test.nc -g does_not_exist) -eq 0 || fail_ ncexists found a non-existent global attribute diff --git a/tools/ncexists/Makefile.am b/tests/ncexists/no-g-or-v old mode 100644 new mode 100755 similarity index 50% rename from tools/ncexists/Makefile.am rename to tests/ncexists/no-g-or-v index e6dc2963..5b8accc6 --- a/tools/ncexists/Makefile.am +++ b/tests/ncexists/no-g-or-v @@ -1,27 +1,33 @@ -#*********************************************************************** -# GNU Lesser General Public License -# +#!/bin/sh + +# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory + # This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under + +# FRE-NCtools is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or (at # your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT + +# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. -# + # You should have received a copy of the GNU Lesser General Public # License along with FRE-NCTools. If not, see # . -#*********************************************************************** -bin_PROGRAMS = ncexists -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) +if test "$VERBOSE" = yes +then + set -x + command -v ncexists + ncexists --version +fi + +. "${srcdir=.}/init.sh" + +$top_srcdir/tests/ncexists/create-test-file.sh || framework_failure_ "Failed to create test file" -ncexists_SOURCES = ncexists.c +# This test should fail because -v or -g is not specified +ncexists -f test.nc && fail_ ncexists should exit with an error code when -g or -v is not specified || true diff --git a/tests/ncexists/nofile b/tests/ncexists/nofile new file mode 100755 index 00000000..c226c696 --- /dev/null +++ b/tests/ncexists/nofile @@ -0,0 +1,34 @@ +#!/bin/sh + +# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory + +# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). + +# FRE-NCtools is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. + +# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with FRE-NCTools. If not, see +# . + +if test "$VERBOSE" = yes +then + set -x + command -v ncexists + ncexists --version +fi + +. "${srcdir=.}/init.sh" + +$top_srcdir/tests/ncexists/create-test-file.sh || framework_failure_ "Failed to create test file" + +# Both are tests that should fail. +ncexists && fail_ ncexists should exit with an error code if -f is not specified || true +ncexists -f does-not-exist.nc && fail_ ncexists should exit with an error code if the file does not exist || true diff --git a/tests/ncexists/variable b/tests/ncexists/variable new file mode 100755 index 00000000..cd405f67 --- /dev/null +++ b/tests/ncexists/variable @@ -0,0 +1,33 @@ +#!/bin/sh + +# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory + +# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). + +# FRE-NCtools is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. + +# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with FRE-NCTools. If not, see +# . + +if test "$VERBOSE" = yes +then + set -x + command -v ncexists + ncexists --version +fi + +. "${srcdir=.}/init.sh" + +"${top_srcdir=../..}/tests/ncexists/create-test-file.sh" || framework_failure_ "Failed to create test file" + +test $(ncexists -f test.nc -v var) -eq 1 || fail_ ncexists did not find the var variable +test $(ncexists -f test.nc -v does_not_exist) -eq 0 || fail_ ncexists found a non-existent variable diff --git a/tests/ncexists/variable-attribute b/tests/ncexists/variable-attribute new file mode 100755 index 00000000..7b082e7d --- /dev/null +++ b/tests/ncexists/variable-attribute @@ -0,0 +1,34 @@ +#!/bin/sh + +# Copyright (C) 2024 Geophysical Fluid Dynamics Laboratory + +# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). + +# FRE-NCtools is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. + +# FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with FRE-NCTools. If not, see +# . + +if test "$VERBOSE" = yes +then + set -x + command -v ncexists + ncexists --version +fi + +. "${srcdir=.}/init.sh" + +$top_srcdir/tests/ncexists/create-test-file.sh || framework_failure_ "Failed to create test file" + +test $(ncexists -f test.nc -v var -a missing_value) -eq 1 || fail_ ncexists did not find the var:missing_value attribute +test $(ncexists -f test.nc -v var -a does_not_exist) -eq 0 || fail_ ncexists found a non-existent variable attribute +test $(ncexists -f test.nc -v does_not_exist -a missing_value) -eq 0 || fail_ ncexists found a non-existent variable diff --git a/tools/check_mask/Makefile.am b/tools/check_mask/Makefile.am deleted file mode 100644 index ffef32e5..00000000 --- a/tools/check_mask/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = check_mask - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -check_mask_SOURCES = check_mask.c diff --git a/tools/cubic_utils/Makefile.am b/tools/cubic_utils/Makefile.am deleted file mode 100644 index e6b9af4c..00000000 --- a/tools/cubic_utils/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_remap_file - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_remap_file_SOURCES = make_remap_file.c diff --git a/tools/fregrid_gpu/Makefile.am b/tools/fregrid_gpu/Makefile.am deleted file mode 100644 index 68b17faf..00000000 --- a/tools/fregrid_gpu/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = fregrid_gpu - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils $(NETCDF_CFLAGS) \ - -I$(top_srcdir)/tools/libfrencutils_gpu \ - -I$(top_srcdir)/tools/fregrid \ - $(OPENACC_CFLAGS) -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -fregrid_gpu_SOURCES = conserve_interp_gpu.c \ - conserve_interp_gpu.h \ - interp_utils_gpu.c \ - interp_utils_gpu.h \ - fregrid_utils_gpu.c \ - fregrid_utils_gpu.h \ - fregrid_gpu.c - -fregrid_gpu_LDADD = $(top_builddir)/tools/fregrid/fregrid_util.o \ - $(top_builddir)/tools/fregrid/conserve_interp.o \ - $(top_builddir)/tools/fregrid/bilinear_interp.o \ - $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a \ - $(LDADD) diff --git a/tools/libfrencutils/Makefile.am b/tools/libfrencutils/Makefile.am deleted file mode 100644 index b6eeb334..00000000 --- a/tools/libfrencutils/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -noinst_LIBRARIES = libfrencutils.a -if WITH_MPI - noinst_LIBRARIES += libfrencutils_mpi.a -endif - -AM_CFLAGS = $(NETCDF_CFLAGS) - -libfrencutils_a_SOURCES = affinity.c \ - constant.h \ - create_xgrid.c \ - create_xgrid.h \ - globals.h \ - gradient_c2l.c \ - gradient_c2l.h \ - interp.c \ - interp.h \ - mosaic_util.c \ - mosaic_util.h \ - mpp_domain.c \ - mpp_domain.h \ - mpp_io.c \ - mpp_io.h \ - mpp.c \ - mpp.h \ - read_mosaic.c \ - read_mosaic.h \ - tool_util.c \ - tool_util.h - -libfrencutils_mpi_a_SOURCES = $(libfrencutils_a_SOURCES) -libfrencutils_mpi_a_CFLAGS = -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS) diff --git a/tools/libfrencutils_gpu/Makefile.am b/tools/libfrencutils_gpu/Makefile.am deleted file mode 100644 index 022900fe..00000000 --- a/tools/libfrencutils_gpu/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -noinst_LIBRARIES = libfrencutils_gpu.a - -AM_CFLAGS = $(NETCDF_CFLAGS) $(OPENACC_CFLAGS) -I$(top_srcdir)/tools/libfrencutils - -libfrencutils_gpu_a_SOURCES = create_xgrid_gpu.c \ - create_xgrid_gpu.h \ - create_xgrid_utils_gpu.c \ - create_xgrid_utils_gpu.h \ - general_utils_gpu.c \ - general_utils_gpu.h - -libfrencutils_gpu_a_LIBADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a diff --git a/tools/make_coupler_mosaic/Makefile.am b/tools/make_coupler_mosaic/Makefile.am deleted file mode 100644 index d766e9b9..00000000 --- a/tools/make_coupler_mosaic/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_coupler_mosaic -if WITH_MPI - bin_PROGRAMS += make_coupler_mosaic_parallel -endif - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_coupler_mosaic_SOURCES = make_coupler_mosaic.c -make_coupler_mosaic_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a $(LDADD) - -make_coupler_mosaic_parallel_SOURCES = $(make_coupler_mosaic_SOURCES) -make_coupler_mosaic_parallel_CFLAGS = -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS) -make_coupler_mosaic_parallel_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils_mpi.a $(LDADD) $(MPI_CLDFLAGS) diff --git a/tools/make_hgrid/Makefile.am b/tools/make_hgrid/Makefile.am deleted file mode 100644 index 8862f38d..00000000 --- a/tools/make_hgrid/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_hgrid - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_hgrid_SOURCES = create_conformal_cubic_grid.c \ - create_gnomonic_cubic_grid.c \ - create_grid_from_file.c \ - create_hgrid.h \ - create_lonlat_grid.c \ - make_hgrid.c -make_hgrid_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a $(LDADD) diff --git a/tools/make_land_domain/Makefile.am b/tools/make_land_domain/Makefile.am deleted file mode 100644 index 9936c01c..00000000 --- a/tools/make_land_domain/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_land_domain - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_land_domain_SOURCES = make_land_domain.c diff --git a/tools/make_quick_mosaic/Makefile.am b/tools/make_quick_mosaic/Makefile.am deleted file mode 100644 index 148805cb..00000000 --- a/tools/make_quick_mosaic/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_quick_mosaic - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_quick_mosaic_SOURCES = make_quick_mosaic.c diff --git a/tools/make_regional_mosaic/Makefile.am b/tools/make_regional_mosaic/Makefile.am deleted file mode 100644 index 7ef2d039..00000000 --- a/tools/make_regional_mosaic/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_regional_mosaic - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_regional_mosaic_SOURCES = make_regional_mosaic.c diff --git a/tools/make_solo_mosaic/Makefile.am b/tools/make_solo_mosaic/Makefile.am deleted file mode 100644 index 17f3549e..00000000 --- a/tools/make_solo_mosaic/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_solo_mosaic - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_solo_mosaic_SOURCES = get_contact.c \ - get_contact.h \ - make_solo_mosaic.c diff --git a/tools/make_topog/Makefile.am b/tools/make_topog/Makefile.am deleted file mode 100644 index 169ebc18..00000000 --- a/tools/make_topog/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_topog -if WITH_MPI - bin_PROGRAMS += make_topog_parallel -endif - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_topog_SOURCES = make_topog.c \ - topog.c \ - topog.h -make_topog_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a $(LDADD) - -make_topog_parallel_SOURCES = $(make_topog_SOURCES) -make_topog_parallel_CFLAGS = -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS) -make_topog_parallel_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils_mpi.a $(LDADD) $(MPI_CLDFLAGS) diff --git a/tools/make_vgrid/Makefile.am b/tools/make_vgrid/Makefile.am deleted file mode 100644 index d79e4768..00000000 --- a/tools/make_vgrid/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = make_vgrid - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -make_vgrid_SOURCES = create_vgrid.c \ - create_vgrid.h \ - make_vgrid.c diff --git a/tools/mppncscatter/Makefile.am b/tools/mppncscatter/Makefile.am deleted file mode 100644 index 2b369cb3..00000000 --- a/tools/mppncscatter/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = mppncscatter - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -mppncscatter_SOURCES = common.h \ - main.c \ - mppncscatter.c \ - mppncscatter.h \ - opt.c \ - opt.h \ - scatterdim.c \ - scatterdim.h \ - strlist.c \ - strlist.h \ - util.h \ - xmalloc.c \ - xmalloc.h diff --git a/tools/nc_null_check/Makefile.am b/tools/nc_null_check/Makefile.am deleted file mode 100644 index 120228f3..00000000 --- a/tools/nc_null_check/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = nc_null_check - -AM_FCFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_FCFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_FCLDFLAGS) $(NETCDF_FCLIBS) $(RPATH_FLAGS) - -nc_null_check_SOURCES = nc_null_check.F90 diff --git a/tools/nc_null_check/nc_null_check.F90 b/tools/nc_null_check/nc_null_check.F90 deleted file mode 100644 index a0de010f..00000000 --- a/tools/nc_null_check/nc_null_check.F90 +++ /dev/null @@ -1,85 +0,0 @@ -!*********************************************************************** -!* GNU Lesser General Public License -!* -!* This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -!* -!* FRE-NCTools is free software: you can redistribute it and/or modify it under -!* the terms of the GNU Lesser General Public License as published by -!* the Free Software Foundation, either version 3 of the License, or (at -!* your option) any later version. -!* -!* FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -!* for more details. -!* -!* You should have received a copy of the GNU Lesser General Public -!* License along with FRE-NCTools.. If not, see -!* . -!*********************************************************************** - -program nc_null - -use netcdf -use iso_c_binding - -implicit none - -character (len=200) :: filename !< The name of the file to be checked -character (len=10) :: varname !< The variable to be checked -character (len=6) :: attribute_name="bounds" !< The attirbute to be checked -character (len=20) :: attribute_value !< THe value of the attribute -integer :: ncid !< The netcdf file ID -integer :: varid !< The netcdf variable ID -integer :: att_len !< The length of the attribute string -integer :: i !< For looping -logical :: null_found = .false. !< True if a null character is found -integer :: arglen, istatus - -!> Get the file name from the command line -call get_command_argument(1 , filename, arglen, istatus) -if (istatus .ne. 0) then - !> Print error message if no file is given - write (6,*) "Please enter a FILENAME argument on the command line" - write (6,*) "nc-null-check FILENAME" - stop -endif -!> Tell the user the name of the file being processed -write (6,*) "Checking "//trim(filename) -write (6,*) " " -!> Check the lat variable -varname = "lat" -!> Open file - call check( nf90_open(FILENAME, nf90_nowrite, ncid) ) -!> The the varid - call check( nf90_inq_varid(ncid, varname, varid) ) -!> Get the value of the desired attribute - call check( nf90_get_att(ncid, varid, attribute_name, attribute_value) ) -!> Get the length of the attribute value - call check( nf90_inquire_attribute(ncid, varid, attribute_name, len = att_len) ) - -!> Loop through each character in the attribute value string to check for a null character -do i = 1,len(attribute_value) - if (attribute_value(i:i) == c_null_char) then - !> If a null character is found, inform the user - write (6,*) "The variable "//trim(varname)//" in "//trim(filename)//" has a null character "//& - "in attribute "//trim(attribute_name)//"::"//trim(attribute_value) - null_found = .true. - endif -enddo -!> If not null character is found, inform the user -if (.not. null_found) write (6,*) "No null character found" -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -contains -!> Check for netcdf errors - subroutine check(status) - integer, intent ( in) :: status - - if(status /= nf90_noerr) then - print *, trim(nf90_strerror(status)) - stop "Stopped" - end if - end subroutine check - -end program nc_null - diff --git a/tools/ncexists/ncexists.c b/tools/ncexists/ncexists.c deleted file mode 100644 index 7cc6610a..00000000 --- a/tools/ncexists/ncexists.c +++ /dev/null @@ -1,156 +0,0 @@ -/*********************************************************************** - * GNU Lesser General Public License - * - * This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). - * - * FRE-NCtools is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * FRE-NCtools is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FRE-NCTools. If not, see - * . - **********************************************************************/ -/* - Copyright (C) 2011 NOAA Geophysical Fluid Dynamics Lab, Princeton, NJ -*/ -#include -#include -#include -#include -#include -#include -#include "getopt.h" - -void handle_error(int status); - -int main (int argc, char **argv) -{ - - int status; - char *filename = NULL; - char *attr = NULL; - char *gattr = NULL; - int ncid; - char *var_name = NULL; - size_t vr_len; - int var_id; - size_t t_len; - int global = 0; - int c; - char *usage = "Usage: ncexists -f filename [ -g global_attribute || -v variable || -v variable -a attribute ]\n Returns 1 if variable or attribute is found, 0 if not found.\n"; - nc_type vr_type, t_type; - - - - if (argc == 1) - { - printf ("%s\n",usage); - //printf ("No arguments: exiting\n"); - return 0; - } - else - { - while ((c = getopt (argc, argv, "f:v:g:a:")) != -1) - { - switch (c) - { - case 'f': - filename = optarg; - break; - - case 'g': - gattr = optarg; - global = 1; - break; - - case 'v': - var_name = optarg; - break; - - case 'a': - attr= optarg; - break; - - - - case '?': - printf("%s\n", usage); - return 1; - default: - printf("%s\n", usage); - abort (); - } - } - - if (global == 1) - { - - status = nc_open(filename, NC_NOWRITE, &ncid); - if (status != NC_NOERR) handle_error(status); - - status = nc_inq_att (ncid, NC_GLOBAL, gattr, &t_type, &t_len); - if (status == NC_NOERR) - { - printf ("1\n"); - } - else - { - printf ("0\n"); - } - } - else - { - status = nc_open(filename, 0, &ncid); - if (status != NC_NOERR) handle_error(status); - - status = nc_inq_varid (ncid, var_name, &var_id); - if (status == NC_NOERR) - { - if ( attr == NULL ) - { - printf ("1\n"); - } - else - { - status = nc_inq_att (ncid, var_id, attr, &vr_type, &vr_len); - if (status == NC_NOERR) - { - printf ("1\n"); - } - else - { - printf ("0\n"); - } - } - } - else - { - printf ("0\n"); - } - } - - - status = nc_close(ncid); /* close netCDF dataset */ - if (status != NC_NOERR) handle_error(status); - -} - - - exit(0); -} - -void handle_error(int status) -{ - if (status != NC_NOERR) - { - fprintf(stderr, "%s\n", nc_strerror(status)); - exit(-1); - } -} diff --git a/tools/remap_land/Makefile.am b/tools/remap_land/Makefile.am deleted file mode 100644 index fa1f0416..00000000 --- a/tools/remap_land/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = remap_land -if WITH_MPI - bin_PROGRAMS += remap_land_parallel -endif - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -remap_land_SOURCES = remap_land.c -remap_land_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a $(LDADD) - -remap_land_parallel_SOURCES = $(remap_land_SOURCES) -remap_land_parallel_CFLAGS = -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS) -remap_land_parallel_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils_mpi.a $(LDADD) $(MPI_CLDFLAGS) diff --git a/tools/river_regrid/Makefile.am b/tools/river_regrid/Makefile.am deleted file mode 100644 index 2e29d1bd..00000000 --- a/tools/river_regrid/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = river_regrid - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -river_regrid_SOURCES = river_regrid.c diff --git a/tools/runoff_regrid/Makefile.am b/tools/runoff_regrid/Makefile.am deleted file mode 100644 index df9a87d7..00000000 --- a/tools/runoff_regrid/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = runoff_regrid -if WITH_MPI - bin_PROGRAMS += runoff_regrid_parallel -endif - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -runoff_regrid_SOURCES = runoff_regrid.c -runoff_regrid_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a $(LDADD) - -runoff_regrid_parallel_SOURCES = $(runoff_regrid_SOURCES) -runoff_regrid_parallel_CFLAGS = -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS) -runoff_regrid_parallel_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils_mpi.a $(LDADD) $(MPI_CLDFLAGS) diff --git a/tools/simple_hydrog/Makefile.am b/tools/simple_hydrog/Makefile.am index 2211f577..d1df7557 100644 --- a/tools/simple_hydrog/Makefile.am +++ b/tools/simple_hydrog/Makefile.am @@ -23,5 +23,5 @@ dist_bin_SCRIPTS = share/make_simple_hydrog.csh if HAVE_TEST25_INPUT data_DATA = share/gigbp2_0ll.nc share/river_network_mrg_0.5deg_ad3nov_fill_coast_auto1_0.125.nc -EXTRA_DIST = $(data_DATA) +EXTRA_DIST = $(data_DATA) endif diff --git a/tools/simple_hydrog/lakes/Makefile.am b/tools/simple_hydrog/lakes/Makefile.am index d77b1134..f4196c8d 100644 --- a/tools/simple_hydrog/lakes/Makefile.am +++ b/tools/simple_hydrog/lakes/Makefile.am @@ -17,17 +17,44 @@ # License along with FRE-NCTools. If not, see # . #*********************************************************************** +# cspell:ignore libfms + bin_PROGRAMS = cr_lake_files +cr_lake_files_SOURCES = cr_lake_files.F90 + # Location of FMS library. -# TODO: allow builder to override and use a different libfms. -FMSROOT = $(top_builddir)/tools/simple_hydrog/libfmslite +if WITHOUT_EXTERN_FMS +cr_lake_files_SOURCES += \ + constants.F90 \ + horiz_interp.F90 \ + horiz_interp_bilinear.F90 \ + horiz_interp_type.F90 \ + mpp.F90 \ + mpp_error_a_a.h \ + mpp_error_a_s.h \ + mpp_error_s_a.h \ + mpp_error_s_s.h +endif -AM_CFLAGS = $(NETCDF_CFLAGS) -AM_FCFLAGS = -I$(FMSROOT) $(FC_DEFAULT_REAL_KIND8_FLAG) $(NETCDF_FCFLAGS) -I$(top_builddir)/lib/libnfu -LDADD = $(NETCDF_FCLDFLAGS) $(NETCDF_LIBS) $(NETCDF_FCLIBS) $(RPATH_FLAGS) +AM_FCFLAGS = $(LIBFMS_FCFLAGS) $(FC_DEFAULT_REAL_KIND8_FLAG) $(NETCDF_FCFLAGS) -I$(top_builddir)/lib/libnfu +LDADD = $(NETCDF_FCLDFLAGS) $(NETCDF_FCLIBS) $(RPATH_FLAGS) -cr_lake_files_SOURCES = cr_lake_files.F90 -cr_lake_files_LDADD = $(FMSROOT)/libfms.a $(top_builddir)/lib/libnfu/libnfu.a $(LDADD) +cr_lake_files_LDADD = $(top_builddir)/lib/libnfu/libnfu.a $(LIBFMS_LIBS) $(LDADD) + +if WITHOUT_EXTERN_FMS +cr_lake_files.o: horiz_interp.$(OBJEXT) +endif + +constants_mod.mod: constants.$(OBJEXT) +mpp_mod.mod: mpp.$(OBJEXT) +horiz_interp_type_mod.mod: mpp_mod.mod horiz_interp_type.$(OBJEXT) +horiz_interp_bilinear_mod.mod: constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod horiz_interp_bilinear.$(OBJEXT) +horiz_interp_mod.mod: constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod horiz_interp_bilinear_mod.mod horiz_intrep.$(OBJEXT) + +mpp.$(OBJEXT): mpp.F90 mpp_error_a_a.h mpp_error_a_s.h mpp_error_s_a.h mpp_error_s_s.h +horiz_interp_type.$(OBJEXT): horiz_interp_type.F90 mpp_mod.mod +horiz_interp_bilinear.$(OBJEXT): horiz_interp_bilinear.F90 constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod +horiz_interp.$(OBJEXT): horiz_interp.F90 constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod horiz_interp_bilinear_mod.mod CLEANFILES = *.mod diff --git a/tools/simple_hydrog/libfmslite/constants.F90 b/tools/simple_hydrog/lakes/constants.F90 similarity index 100% rename from tools/simple_hydrog/libfmslite/constants.F90 rename to tools/simple_hydrog/lakes/constants.F90 diff --git a/tools/simple_hydrog/libfmslite/horiz_interp.F90 b/tools/simple_hydrog/lakes/horiz_interp.F90 similarity index 100% rename from tools/simple_hydrog/libfmslite/horiz_interp.F90 rename to tools/simple_hydrog/lakes/horiz_interp.F90 diff --git a/tools/simple_hydrog/libfmslite/horiz_interp_bilinear.F90 b/tools/simple_hydrog/lakes/horiz_interp_bilinear.F90 similarity index 100% rename from tools/simple_hydrog/libfmslite/horiz_interp_bilinear.F90 rename to tools/simple_hydrog/lakes/horiz_interp_bilinear.F90 diff --git a/tools/simple_hydrog/libfmslite/horiz_interp_type.F90 b/tools/simple_hydrog/lakes/horiz_interp_type.F90 similarity index 100% rename from tools/simple_hydrog/libfmslite/horiz_interp_type.F90 rename to tools/simple_hydrog/lakes/horiz_interp_type.F90 diff --git a/tools/simple_hydrog/libfmslite/mpp.F90 b/tools/simple_hydrog/lakes/mpp.F90 similarity index 100% rename from tools/simple_hydrog/libfmslite/mpp.F90 rename to tools/simple_hydrog/lakes/mpp.F90 diff --git a/tools/simple_hydrog/libfmslite/mpp_error_a_a.h b/tools/simple_hydrog/lakes/mpp_error_a_a.h similarity index 100% rename from tools/simple_hydrog/libfmslite/mpp_error_a_a.h rename to tools/simple_hydrog/lakes/mpp_error_a_a.h diff --git a/tools/simple_hydrog/libfmslite/mpp_error_a_s.h b/tools/simple_hydrog/lakes/mpp_error_a_s.h similarity index 100% rename from tools/simple_hydrog/libfmslite/mpp_error_a_s.h rename to tools/simple_hydrog/lakes/mpp_error_a_s.h diff --git a/tools/simple_hydrog/libfmslite/mpp_error_s_a.h b/tools/simple_hydrog/lakes/mpp_error_s_a.h similarity index 100% rename from tools/simple_hydrog/libfmslite/mpp_error_s_a.h rename to tools/simple_hydrog/lakes/mpp_error_s_a.h diff --git a/tools/simple_hydrog/libfmslite/mpp_error_s_s.h b/tools/simple_hydrog/lakes/mpp_error_s_s.h similarity index 100% rename from tools/simple_hydrog/libfmslite/mpp_error_s_s.h rename to tools/simple_hydrog/lakes/mpp_error_s_s.h diff --git a/tools/simple_hydrog/libfmslite/Makefile.am b/tools/simple_hydrog/libfmslite/Makefile.am deleted file mode 100644 index d2eaebae..00000000 --- a/tools/simple_hydrog/libfmslite/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -noinst_LIBRARIES = libfms.a - -AM_FCFLAGS = $(FC_DEFAULT_REAL_KIND8_FLAG) - -libfms_a_SOURCES = constants.F90 \ - horiz_interp.F90 \ - horiz_interp_bilinear.F90 \ - horiz_interp_type.F90 \ - mpp.F90 \ - mpp_error_a_a.h \ - mpp_error_a_s.h \ - mpp_error_s_a.h \ - mpp_error_s_s.h - -constants_mod.mod: constants.$(OBJEXT) -mpp_mod.mod: mpp.$(OBJEXT) -horiz_interp_type_mod.mod: mpp_mod.mod horiz_interp_type.$(OBJEXT) -horiz_interp_bilinear_mod.mod: constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod horiz_interp_bilinear.$(OBJEXT) -horiz_interp_mod.mod: constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod horiz_interp_bilinear_mod.mod horiz_intrep.$(OBJEXT) - -mpp.$(OBJEXT): mpp.F90 mpp_error_a_a.h mpp_error_a_s.h mpp_error_s_a.h mpp_error_s_s.h -horiz_interp_type.$(OBJEXT): horiz_interp_type.F90 mpp_mod.mod -horiz_interp_bilinear.$(OBJEXT): horiz_interp_bilinear.F90 constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod -horiz_interp.$(OBJEXT): horiz_interp.F90 constants_mod.mod mpp_mod.mod horiz_interp_type_mod.mod horiz_interp_bilinear_mod.mod - -CLEANFILES = *.mod diff --git a/tools/transfer_to_mosaic_grid/Makefile.am b/tools/transfer_to_mosaic_grid/Makefile.am deleted file mode 100644 index 42d62063..00000000 --- a/tools/transfer_to_mosaic_grid/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL FRE NetCDF tools package (FRE-NCTools). -# -# FRE-NCTools is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# FRE-NCTools is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with FRE-NCTools. If not, see -# . -#*********************************************************************** -bin_PROGRAMS = transfer_to_mosaic_grid - -AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \ - $(NETCDF_CFLAGS) -LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \ - $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) - -transfer_to_mosaic_grid_SOURCES = transfer_to_mosaic.c