diff --git a/src/core_ocean/mode_init/Makefile b/src/core_ocean/mode_init/Makefile
index 2ad3ef04d7..1f4ac4983f 100644
--- a/src/core_ocean/mode_init/Makefile
+++ b/src/core_ocean/mode_init/Makefile
@@ -24,6 +24,7 @@ TEST_CASES = mpas_ocn_init_baroclinic_channel.o \
mpas_ocn_init_global_ocean.o \
mpas_ocn_init_isomip.o \
mpas_ocn_init_isomip_plus.o \
+ mpas_ocn_init_hurricane.o \
mpas_ocn_init_tidal_boundary.o
#mpas_ocn_init_TEMPLATE.o
@@ -75,6 +76,8 @@ mpas_ocn_init_isomip_plus.o: $(UTILS)
mpas_ocn_init_ziso.o: $(UTILS)
+mpas_ocn_init_hurricane.o: $(UTILS)
+
mpas_ocn_init_tidal_boundary.o: $(UTILS)
#mpas_ocn_init_TEMPLATE.o: $(UTILS)
diff --git a/src/core_ocean/mode_init/Registry.xml b/src/core_ocean/mode_init/Registry.xml
index 72afb0d369..293c902f19 100644
--- a/src/core_ocean/mode_init/Registry.xml
+++ b/src/core_ocean/mode_init/Registry.xml
@@ -14,5 +14,6 @@
#include "Registry_sea_mount.xml"
#include "Registry_isomip.xml"
#include "Registry_isomip_plus.xml"
+#include "Registry_hurricane.xml"
#include "Registry_tidal_boundary.xml"
// #include "Registry_TEMPLATE.xml"
diff --git a/src/core_ocean/mode_init/Registry_hurricane.xml b/src/core_ocean/mode_init/Registry_hurricane.xml
new file mode 100644
index 0000000000..47b4fdaf7f
--- /dev/null
+++ b/src/core_ocean/mode_init/Registry_hurricane.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/src/core_ocean/mode_init/mpas_ocn_init_hurricane.F b/src/core_ocean/mode_init/mpas_ocn_init_hurricane.F
new file mode 100644
index 0000000000..edd8359620
--- /dev/null
+++ b/src/core_ocean/mode_init/mpas_ocn_init_hurricane.F
@@ -0,0 +1,342 @@
+! Copyright (c) 2013, Los Alamos National Security, LLC (LANS)
+! and the University Corporation for Atmospheric Research (UCAR).
+!
+! Unless noted otherwise source code is licensed under the BSD license.
+! Additional copyright and license information can be found in the LICENSE file
+! distributed with this code, or at http://mpas-dev.github.com/license.html
+!
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+! ocn_init_hurricane
+!
+!> \brief MPAS ocean initialize case -- hurricane
+!> \author Steven Brus
+!> \date 01/08/19
+!> \details
+!> This module contains the routines for initializing a hurricane.
+!>
+!-----------------------------------------------------------------------
+
+module ocn_init_hurricane
+
+ use mpas_kind_types
+ use mpas_io_units
+ use mpas_derived_types
+ use mpas_pool_routines
+ use mpas_constants
+ use mpas_dmpar
+
+ use ocn_constants
+ use ocn_init_vertical_grids
+ use ocn_init_cell_markers
+
+ implicit none
+ private
+ save
+
+ !--------------------------------------------------------------------
+ !
+ ! Public parameters
+ !
+ !--------------------------------------------------------------------
+
+ !--------------------------------------------------------------------
+ !
+ ! Public member functions
+ !
+ !--------------------------------------------------------------------
+
+ public :: ocn_init_setup_hurricane, &
+ ocn_init_validate_hurricane
+
+ !--------------------------------------------------------------------
+ !
+ ! Private module variables
+ !
+ !--------------------------------------------------------------------
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+! routine ocn_init_setup_hurricane
+!
+!> \brief Setup for this initial condition
+!> \author Steven Brus
+!> \date 01/08/19
+!> \details
+!> This routine sets up the initial conditions for this case.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_init_setup_hurricane(domain, iErr)!{{{
+
+ !--------------------------------------------------------------------
+
+ type (domain_type), intent(inout) :: domain
+ integer, intent(out) :: iErr
+
+ type (block_type), pointer :: block_ptr
+ type (mpas_pool_type), pointer :: meshPool
+ type (mpas_pool_type), pointer :: statePool
+ type (mpas_pool_type), pointer :: tracersPool
+ type (mpas_pool_type), pointer :: verticalMeshPool
+ type (mpas_pool_type), pointer :: diagnosticsPool
+
+ ! local variables
+ integer :: iCell, k, idx, iEdge, iVertex
+ real (kind=RKIND) :: dlon, dlat, dw
+ real (kind=RKIND) :: maxBottomDepth, globalMaxBottomDepth
+ real (kind=RKIND), dimension(:), pointer :: interfaceLocations
+ real (kind=RKIND), parameter :: pi = 4.0_RKIND*ATAN(1.0_RKIND)
+
+ ! Define config variable pointers
+ character (len=StrKIND), pointer :: config_init_configuration, config_vertical_grid
+ integer, pointer :: config_hurricane_vert_levels
+ real (kind=RKIND), pointer :: config_hurricane_min_depth
+ real (kind=RKIND), pointer :: config_hurricane_max_depth
+
+ ! Define dimension pointers
+ integer, pointer :: nCellsSolve, nEdgesSolve, nVerticesSolve, nVertLevels, nVertLevelsP1
+ integer, pointer :: index_temperature, index_salinity
+
+ ! Define variable pointers
+ logical, pointer :: on_a_sphere
+ integer, dimension(:), pointer :: maxLevelCell
+ real (kind=RKIND), dimension(:), pointer :: ssh
+ real (kind=RKIND), dimension(:), pointer :: refBottomDepth, refZMid, &
+ vertCoordMovementWeights, bottomDepth, bottomDepthObserved, &
+ fCell, fEdge, fVertex, &
+ latCell, latEdge, latVertex, &
+ lonCell
+ real (kind=RKIND), dimension(:,:), pointer :: layerThickness, restingThickness
+ real (kind=RKIND), dimension(:,:,:), pointer :: activeTracers
+
+ iErr = 0
+
+ call mpas_pool_get_config(ocnConfigs, 'config_init_configuration', config_init_configuration)
+
+ if(config_init_configuration .ne. trim('hurricane')) return
+
+ ! Get config flag settings
+ call mpas_pool_get_config(ocnConfigs, 'config_vertical_grid', config_vertical_grid)
+ call mpas_pool_get_config(ocnConfigs, 'config_hurricane_vert_levels', config_hurricane_vert_levels)
+ call mpas_pool_get_config(ocnConfigs, 'config_hurricane_min_depth', config_hurricane_min_depth)
+ call mpas_pool_get_config(ocnConfigs, 'config_hurricane_max_depth', config_hurricane_max_depth)
+
+ ! Determine vertical grid for configuration
+ call mpas_pool_get_subpool(domain % blocklist % structs, 'mesh', meshPool)
+ call mpas_pool_get_dimension(meshPool, 'nVertLevels', nVertLevels)
+ call mpas_pool_get_dimension(meshPool, 'nVertLevelsP1', nVertLevelsP1)
+ call mpas_pool_get_config(meshPool, 'on_a_sphere', on_a_sphere)
+
+ ! you may restrict your case geometry as follows:
+ if ( .not. on_a_sphere ) call mpas_log_write('The hurricane configuration can only be applied ' &
+ // 'to a spherical mesh. Exiting...', MPAS_LOG_CRIT)
+
+ nVertLevels = config_hurricane_vert_levels
+ nVertLevelsP1 = nVertLevels + 1
+
+
+ allocate(interfaceLocations(nVertLevelsP1))
+ call ocn_generate_vertical_grid( config_vertical_grid, interfaceLocations, ocnConfigs )
+
+ ! Find max bottom depth
+ maxBottomDepth = 9e10
+ block_ptr => domain % blocklist
+ do while(associated(block_ptr))
+ call mpas_pool_get_subpool(block_ptr % structs, 'mesh', meshPool)
+ call mpas_pool_get_array(meshPool, 'bottomDepthObserved', bottomDepthObserved)
+
+ if (MINVAL(bottomDepthObserved) < maxBottomDepth) then
+ maxBottomDepth = MINVAL(bottomDepthObserved)
+ end if
+
+ block_ptr => block_ptr % next
+ end do
+ maxBottomDepth = -1.0_RKIND*maxBottomDepth
+
+ ! Enforce max bottom depth from namelist option
+ call mpas_dmpar_max_real(domain % dminfo, maxBottomDepth, globalMaxBottomDepth)
+ if (config_hurricane_max_depth < globalMaxBottomDepth) then
+ globalMaxBottomDepth = config_hurricane_max_depth
+ end if
+
+ !--------------------------------------------------------------------
+ ! Use this section to set initial values
+ !--------------------------------------------------------------------
+
+ block_ptr => domain % blocklist
+ do while(associated(block_ptr))
+ call mpas_pool_get_subpool(block_ptr % structs, 'mesh', meshPool)
+ call mpas_pool_get_subpool(block_ptr % structs, 'state', statePool)
+ call mpas_pool_get_subpool(block_ptr % structs, 'verticalMesh', verticalMeshPool)
+ call mpas_pool_get_subpool(block_ptr % structs, 'diagnostics', diagnosticsPool)
+ call mpas_pool_get_subpool(statePool, 'tracers', tracersPool)
+
+ call mpas_pool_get_dimension(meshPool, 'nCellsSolve', nCellsSolve)
+ call mpas_pool_get_dimension(meshPool, 'nEdgesSolve', nEdgesSolve)
+ call mpas_pool_get_dimension(meshPool, 'nVerticesSolve', nVerticesSolve)
+
+ call mpas_pool_get_dimension(tracersPool, 'index_temperature', index_temperature)
+ call mpas_pool_get_dimension(tracersPool, 'index_salinity', index_salinity)
+
+ call mpas_pool_get_array(meshPool, 'vertCoordMovementWeights', vertCoordMovementWeights)
+ call mpas_pool_get_array(meshPool, 'bottomDepth', bottomDepth)
+ call mpas_pool_get_array(meshPool, 'bottomDepthObserved', bottomDepthObserved)
+ call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell)
+ call mpas_pool_get_array(meshPool, 'lonCell', lonCell)
+ call mpas_pool_get_array(meshPool, 'latCell', latCell)
+ call mpas_pool_get_array(meshPool, 'latEdge', latEdge)
+ call mpas_pool_get_array(meshPool, 'latVertex', latVertex)
+ call mpas_pool_get_array(meshPool, 'fCell', fCell)
+ call mpas_pool_get_array(meshPool, 'fEdge', fEdge)
+ call mpas_pool_get_array(meshPool, 'fVertex', fVertex)
+
+ call mpas_pool_get_array(tracersPool, 'activeTracers', activeTracers, 1)
+ call mpas_pool_get_array(statePool, 'layerThickness', layerThickness, 1)
+ call mpas_pool_get_array(statePool, 'ssh', ssh, 1)
+
+ call mpas_pool_get_array(meshPool, 'refBottomDepth', refBottomDepth)
+ call mpas_pool_get_array(verticalMeshPool, 'refZMid', refZMid)
+ call mpas_pool_get_array(verticalMeshPool, 'restingThickness', restingThickness)
+
+ do k = 1, nVertLevels
+ refBottomDepth(k) = globalMaxBottomDepth * interfaceLocations(k+1)
+ refZMid(k) = - 0.5_RKIND * (interfaceLocations(k+1) + interfaceLocations(k)) * globalMaxBottomDepth
+ end do
+
+ ! Set vertCoordMovementWeights
+ vertCoordMovementWeights(:) = 1.0_RKIND
+
+ do iCell = 1, nCellsSolve
+
+ ! Set ssh
+ ssh(iCell) = 0.0_RKIND
+
+ ! enforce minimum and maximum bottom depth
+ bottomDepth(iCell) = max(config_hurricane_min_depth, -1.0_RKIND*bottomDepthObserved(iCell))
+ bottomDepth(iCell) = min(bottomDepth(iCell),globalMaxBottomDepth)
+
+ ! Flatten out Bermuda
+ if ((lonCell(iCell) > (-66.0_RKIND+360.0_RKIND)*pi/180.0_RKIND .and. &
+ lonCell(iCell) < (-62.0_RKIND+360.0_RKIND)*pi/180.0_RKIND) .and. &
+ (latCell(iCell) > 30.0_RKIND*pi/180.0_RKIND .and. &
+ latCell(iCell) < 34.0_RKIND*pi/180.0_RKIND)) then
+
+ bottomDepth(iCell) = globalMaxBottomDepth
+ end if
+
+ ! Set up vertical grid
+ maxLevelCell(iCell) = nVertLevels
+ if (nVertLevels > 10) then
+ ! z-star
+ do k = 1, nVertLevels
+ if (bottomDepth(iCell) < refBottomDepth(k)) then
+ maxLevelCell(iCell) = k-1
+ bottomDepth(iCell) = refBottomDepth(k-1)
+ exit
+ end if
+ end do
+ do k = 1, nVertLevels
+ layerThickness(k,iCell) = globalMaxBottomDepth * (interfaceLocations(k+1) - interfaceLocations(k))
+ end do
+ else
+ ! impermeable layers
+ do k = 1, nVertLevels
+ layerThickness(k,iCell) = bottomDepth(iCell)/real(nVertLevels,RKIND)
+ end do
+ end if
+
+ ! set layer thicknesses
+ do k = 1, nVertLevels
+ restingThickness(k, iCell) = layerThickness(k, iCell)
+ end do
+
+ ! Set temperature
+ idx = index_temperature
+ do k = 1, nVertLevels
+ activeTracers(idx, k, iCell) = 20.0_RKIND
+ end do
+
+ ! Set salinity
+ idx = index_salinity
+ do k = 1, nVertLevels
+ activeTracers(idx, k, iCell) = 33.0_RKIND
+ end do
+
+ end do
+
+
+ ! Set Coriolis parameters
+ do iCell = 1, nCellsSolve
+ fCell(iCell) = 2.0_RKIND * omega * sin(latCell(iCell))
+ end do
+ do iEdge = 1, nEdgesSolve
+ fEdge(iEdge) = 2.0_RKIND * omega * sin(latEdge(iEdge))
+ end do
+ do iVertex = 1, nVerticesSolve
+ fVertex(iVertex) = 2.0_RKIND * omega * sin(latVertex(iVertex))
+ end do
+
+
+ block_ptr => block_ptr % next
+ end do
+
+ deallocate(interfaceLocations)
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_init_setup_hurricane!}}}
+
+!***********************************************************************
+!
+! routine ocn_init_validate_hurricane
+!
+!> \brief Validation for this initial condition
+!> \author Steven Brus
+!> \date 01/08/19
+!> \details
+!> This routine validates the configuration options for this case.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_init_validate_hurricane(configPool, packagePool, iocontext, iErr)!{{{
+
+ !--------------------------------------------------------------------
+ type (mpas_pool_type), intent(inout) :: configPool, packagePool
+ type (mpas_io_context_type), intent(inout) :: iocontext
+
+ integer, intent(out) :: iErr
+
+ character (len=StrKIND), pointer :: config_init_configuration
+ integer, pointer :: config_vert_levels, config_hurricane_vert_levels
+
+ iErr = 0
+
+ call mpas_pool_get_config(configPool, 'config_init_configuration', config_init_configuration)
+
+ if(config_init_configuration .ne. trim('hurricane')) return
+
+ call mpas_pool_get_config(configPool, 'config_vert_levels', config_vert_levels)
+ call mpas_pool_get_config(configPool, 'config_hurricane_vert_levels', config_hurricane_vert_levels)
+
+ if(config_vert_levels <= 0 .and. config_hurricane_vert_levels > 0) then
+ config_vert_levels = config_hurricane_vert_levels
+ else if (config_vert_levels <= 0) then
+ call mpas_log_write( 'Validation failed for hurricane case. Not given a usable value for vertical levels.', MPAS_LOG_CRIT)
+ iErr = 1
+ end if
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_init_validate_hurricane!}}}
+
+
+!***********************************************************************
+
+end module ocn_init_hurricane
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+! vim: foldmethod=marker
diff --git a/src/core_ocean/mode_init/mpas_ocn_init_mode.F b/src/core_ocean/mode_init/mpas_ocn_init_mode.F
index 6b543ec052..8ac6c17532 100644
--- a/src/core_ocean/mode_init/mpas_ocn_init_mode.F
+++ b/src/core_ocean/mode_init/mpas_ocn_init_mode.F
@@ -56,6 +56,7 @@ module ocn_init_mode
use ocn_init_sea_mount
use ocn_init_isomip
use ocn_init_isomip_plus
+ use ocn_init_hurricane
use ocn_init_tidal_boundary
implicit none
@@ -283,6 +284,7 @@ function ocn_init_mode_run(domain) result(iErr)!{{{
call ocn_init_setup_sea_mount(domain, ierr)
call ocn_init_setup_isomip(domain, ierr)
call ocn_init_setup_isomip_plus(domain, ierr)
+ call ocn_init_setup_hurricane(domain, ierr)
call ocn_init_setup_tidal_boundary(domain, ierr)
!call ocn_init_setup_TEMPLATE(domain, ierr)
@@ -389,6 +391,8 @@ subroutine ocn_init_mode_validate_configuration(configPool, packagePool, ioconte
iErr = ior(iErr, err_tmp)
call ocn_init_validate_isomip_plus(configPool, packagePool, iocontext, iErr=err_tmp)
iErr = ior(iErr, err_tmp)
+ call ocn_init_validate_hurricane(configPool, packagePool, iocontext, iErr=err_tmp)
+ iErr = ior(iErr, err_tmp)
call ocn_init_validate_tidal_boundary(configPool, packagePool, iocontext, iErr=err_tmp)
iErr = ior(iErr, err_tmp)
! call ocn_init_validate_TEMPLATE(configPool, packagePool, iocontext, iErr=err_tmp)
diff --git a/src/core_ocean/shared/mpas_ocn_time_varying_forcing.F b/src/core_ocean/shared/mpas_ocn_time_varying_forcing.F
index ec0134e0e0..0770fbf0bc 100644
--- a/src/core_ocean/shared/mpas_ocn_time_varying_forcing.F
+++ b/src/core_ocean/shared/mpas_ocn_time_varying_forcing.F
@@ -381,7 +381,8 @@ subroutine post_atmospheric_forcing(block)!{{{
windStressCoefficient, &
rhoAir, &
ramp, &
- currentTime
+ currentTime, &
+ windStressCoefficientLimit
real(kind=RKIND), pointer:: &
config_forcing_ramp, &
@@ -413,6 +414,7 @@ subroutine post_atmospheric_forcing(block)!{{{
call MPAS_pool_get_array(forcingPool, "atmosphericPressure", atmosphericPressure)
rhoAir = 1.225_RKIND
+ windStressCoefficientLimit = 0.0035_RKIND
ramp = tanh((2.0_RKIND*daysSinceStartOfSim)/config_forcing_ramp)
@@ -422,10 +424,13 @@ subroutine post_atmospheric_forcing(block)!{{{
windSpeedU(iCell) = ramp*windSpeedU(iCell)
windSpeedV(iCell) = ramp*windSpeedV(iCell)
windSpeedMagnitude(iCell) = sqrt(windSpeedU(iCell)**2 + windSpeedV(iCell)**2)
- windStressCoefficient = (0.75_RKIND + 0.067_RKIND * windSpeedMagnitude(iCell)) * 0.001_RKIND * rhoAir ! Garratt 1977
+ windStressCoefficient = (0.75_RKIND + 0.067_RKIND * windSpeedMagnitude(iCell)) * 0.001_RKIND ! Garratt 1977
+ if (windStressCoefficient > windStressCoefficientLimit) then
+ windStressCoefficient = windStressCoefficientLimit
+ end if
- windStressZonal(iCell) = windSpeedU(iCell) * windSpeedMagnitude(iCell) * windStressCoefficient
- windStressMeridional(iCell) = windSpeedV(iCell) * windSpeedMagnitude(iCell) * windStressCoefficient
+ windStressZonal(iCell) = rhoAir * windSpeedU(iCell) * windSpeedMagnitude(iCell) * windStressCoefficient
+ windStressMeridional(iCell) = rhoAir * windSpeedV(iCell) * windSpeedMagnitude(iCell) * windStressCoefficient
atmosphericPressure(iCell) = ((1.0_RKIND-ramp)*atm_ref_pressure + ramp*atmosPressure(iCell)) - atm_ref_pressure
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_base_mesh.xml b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_base_mesh.xml
new file mode 100755
index 0000000000..4a864d206d
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_base_mesh.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+ jigsaw_to_MPAS.build_mesh
+
+
+
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_culled_mesh.xml b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_culled_mesh.xml
new file mode 100644
index 0000000000..2ac7d44371
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_culled_mesh.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+ geometric_data
+
+
+
+ jigsaw_to_MPAS.inject_bathymetry
+ culled_mesh.nc
+
+
+
+
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_driver_init.xml b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_driver_init.xml
new file mode 100644
index 0000000000..5b34eec160
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/config_driver_init.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/define_base_mesh.py b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/define_base_mesh.py
new file mode 100755
index 0000000000..3dccef5aec
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/build_mesh/define_base_mesh.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+import numpy as np
+import jigsaw_to_MPAS.coastal_tools as ct
+
+def cellWidthVsLatLon():
+ km = 1000.0
+
+ params = ct.default_params
+
+ print("****QU 120 background mesh and enhanced Atlantic (30km)****")
+ params["mesh_type"] = "QU"
+ params["dx_max_global"] = 120.0 * km
+ params["region_box"] = ct.Atlantic
+ params["restrict_box"] = ct.Atlantic_restrict
+ params["plot_box"] = ct.Western_Atlantic
+ params["dx_min_coastal"] = 30.0 * km
+ params["trans_width"] = 5000.0 * km
+ params["trans_start"] = 500.0 * km
+
+ cell_width, lon, lat = ct.coastal_refined_mesh(params)
+
+ print("****Northeast refinement (10km)***")
+ params["region_box"] = ct.Delaware_Bay
+ params["plot_box"] = ct.Western_Atlantic
+ params["dx_min_coastal"] = 10.0 * km
+ params["trans_width"] = 600.0 * km
+ params["trans_start"] = 400.0 * km
+
+ cell_width, lon, lat = ct.coastal_refined_mesh(
+ params, cell_width, lon, lat)
+
+ print("****Delaware regional refinement (5km)****")
+ params["region_box"] = ct.Delaware_Region
+ params["plot_box"] = ct.Delaware
+ params["dx_min_coastal"] = 5.0 * km
+ params["trans_width"] = 175.0 * km
+ params["trans_start"] = 75.0 * km
+
+ cell_width, lon, lat = ct.coastal_refined_mesh(
+ params, cell_width, lon, lat)
+
+ print("****Delaware Bay high-resolution (2km)****")
+ params["region_box"] = ct.Delaware_Bay
+ params["plot_box"] = ct.Delaware
+ params["restrict_box"] = ct.Delaware_restrict
+ params["dx_min_coastal"] = 2.0 * km
+ params["trans_width"] = 100.0 * km
+ params["trans_start"] = 17.0 * km
+
+ cell_width, lon, lat = ct.coastal_refined_mesh(
+ params, cell_width, lon, lat)
+
+ return cell_width / 1000, lon, lat
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/NOAA-COOPS_stations.txt b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/NOAA-COOPS_stations.txt
new file mode 100644
index 0000000000..64e9d20c8d
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/NOAA-COOPS_stations.txt
@@ -0,0 +1,28 @@
+-74.1417 40.6367 8519483 Bergen Point West Reach
+-73.7650 40.8103 8516945 Kings Point
+-71.9594 41.0483 8510560 Montauk
+-74.0142 40.7006 8518750 The Battery
+-74.4183 39.3550 8534720 Atlantic City
+-74.8733 40.0800 8539094 Burlington, Delaware River
+-74.9597 38.9678 8536110 Cape May
+-75.3750 39.3050 8537121 Ship John Shoal
+-75.0430 40.0119 8538886 Tacony-Palmyra Bridge
+-75.5883 39.5817 8551762 Delaware City
+-75.1192 38.7828 8557380 Lewes
+-75.5733 39.5583 8551910 Reedy Point
+-76.4816 38.9833 8575512 Annapolis
+-76.5783 39.2667 8574680 Baltimore, Fort McHenry, Patapsco River
+-76.0387 38.2204 8571421 Bishops Head
+-76.0722 38.5742 8571892 Cambridge
+-75.8100 39.5267 8573927 Chesapeake City
+-75.0917 38.3283 8570283 Ocean City Inlet
+-76.4508 38.3172 8577330 Solomons Island
+-76.2450 39.2133 8573364 Tolchester Beach
+-76.1133 36.9667 8638863 Chesapeake Bay Bridge Tunnel
+-75.9884 37.1652 8632200 Kiptopeke
+-76.4646 37.9954 8635750 Lewisetta
+-76.3017 36.7783 8639348 Money Point
+-76.3300 36.9467 8638610 Sewells Point
+-75.6858 37.6078 8631044 Wachapreague
+-76.2900 37.6161 8636580 Windmill Point
+-76.4788 37.2265 8637689 Yorktown USCG Training Center
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/USGS_stations.txt b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/USGS_stations.txt
new file mode 100644
index 0000000000..0aa8239ac8
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/USGS_stations.txt
@@ -0,0 +1,154 @@
+-73.65944 40.9991 SSS-CT-FFD-001WL Fairfield County
+-73.41568 41.09979 SSS-CT-FFD-003WL Fairfield County
+-73.36481 41.14762 SSS-CT-FFD-005WL Fairfield County
+-73.36998 41.1231 SSS-CT-FFD-006WL Fairfield County
+-73.08843 41.25325 SSS-CT-FFD-009WL Fairfield County
+-73.10901 41.16316 SSS-CT-FFD-010WL Fairfield County
+-73.10901 41.16316 SSS-CT-FFD-012WL Fairfield County
+-72.529361 41.269194 SSS-CT-MSX-018WL Middlesex County
+-72.352222 41.281111 SSS-CT-MSX-019WL Middlesex County
+-72.352222 41.281111 SSS-CT-MSX-020WL Middlesex County
+-72.90479 41.27221 SSS-CT-NHV-013WL New Haven County
+-72.874936 41.367328 SSS-CT-NHV-014WL New Haven County
+-72.663611 41.271778 SSS-CT-NHV-015WL New Haven County
+-72.663611 41.271778 SSS-CT-NHV-017WL New Haven County
+-72.820642 41.260402 SSS-CT-NHV-018WL New Haven County
+-72.90479 41.27221 SSS-CT-NHV-019WL New Haven County
+-73.049475 41.211286 SSS-CT-NHV-020WL New Haven County
+-71.9846 41.32525 SSS-CT-NLD-015WL New London County
+-71.9846 41.32525 SSS-CT-NLD-016WL New London County
+-72.1954 41.32147 SSS-CT-NLD-018WL New London County
+-72.277583 41.284278 SSS-CT-NLD-019WL New London County
+-72.3458 41.3125 SSS-CT-NLD-022WL New London County
+-72.277583 41.284278 SSS-CT-NLD-023WL New London County
+-72.060917 41.31675 SSS-CT-NLD-025WL New London County
+-72.0355 41.334972 SSS-CT-NLD-026WL New London County
+-71.967917 41.380806 SSS-CT-NLD-027WL New London County
+-71.967667 41.346667 SSS-CT-NLD-029WL New London County
+-71.909472 41.344333 SSS-CT-NLD-030WL New London County
+-75.397806 39.0585278 SSS-DE-KEN-002WL Kent County
+-75.474972 39.325833 SSS-DE-KEN-051WL Kent County
+-75.446 39.160528 SSS-DE-KEN-053WL Kent County
+-75.609472 39.3092778 SSS-DE-NEW-001WL New Castle County
+-75.163639 38.790222 SSS-DE-SUS-008WL Sussex County
+-75.084194 38.694528 SSS-DE-SUS-010WL Sussex County
+-75.062528 38.513667 SSS-DE-SUS-014WL Sussex County
+-75.058139 38.454889 SSS-DE-SUS-015WL Sussex County
+-75.161833 38.702694 SSS-DE-SUS-030WL Sussex County
+-75.099906 38.625334 SSS-DE-SUS-032WL Sussex County
+-75.211972 38.591639 SSS-DE-SUS-033WL Sussex County
+-75.197 38.76871 SSS-DE-SUS-057WL Sussex County
+-70.333889 43.544722 SSS-ME-CUM-002WL Cumberland County
+-70.356111 43.446667 SSS-ME-YOR-001WL York County
+-70.381944 43.462222 SSS-ME-YOR-002WL York County
+-76.48505 38.976833 SSS-MD-ANN-001WL Anne Arundel County
+-76.4763 38.968611 SSS-MD-ANN-003WL Anne Arundel County
+-76.60608 39.283694 SSS-MD-BAL-001WL Baltimore County
+-76.6058 39.286361 SSS-MD-BAL-003WL Baltimore County
+-70.872545 42.816118 424858070522116 Essex County
+-70.62355 41.65638 SSS-MA-BAR-023WL Barnstable County
+-70.65186 41.60618 SSS-MA-BAR-024WL Barnstable County
+-70.54864 41.55283 SSS-MA-BAR-025WL Barnstable County
+-70.39557 41.62131 SSS-MA-BAR-026WL Barnstable County
+-70.08976 41.66752 SSS-MA-BAR-027WL Barnstable County
+-70.27664 41.63949 SSS-MA-BAR-028WL Barnstable County
+-69.98068 41.80028 SSS-MA-BAR-031WL Barnstable County
+-71.07168 41.51626 SSS-MA-BRI-016WL Bristol County
+-70.84321 41.59597 SSS-MA-BRI-017WL Bristol County
+-70.918315 42.420961 SSS-MA-ESS-037WL Essex County
+-70.88681 42.51951 SSS-MA-ESS-038WL Essex County
+-70.615021 42.658992 SSS-MA-ESS-039WL Essex County
+-70.827774 42.683689 SSS-MA-ESS-040WL Essex County
+-70.820202 42.816934 SSS-MA-ESS-041WL Essex County
+-70.7893 42.23905 SSS-MA-NOR-036WL Norfolk County
+-70.81283 41.65608 SSS-MA-PLY-018WL Plymouth County
+-70.76535 41.71257 SSS-MA-PLY-019WL Plymouth County
+-70.62779 41.74369 SSS-MA-PLY-021WL Plymouth County
+-70.55507 41.92901 SSS-MA-PLY-032WL Plymouth County
+-70.68291 41.98024 SSS-MA-PLY-033WL Plymouth County
+-70.64636 42.08254 SSS-MA-PLY-034WL Plymouth County
+-70.72573 42.20139 SSS-MA-PLY-035WL Plymouth County
+-70.817 42.8982 SSS-NH-ROC-004WL Rockingham County
+-70.8233 42.9218 SSS-NH-ROC-005WL Rockingham County
+-74.46277778 39.55305556 SSS-NJ-ATL-005WL Atlantic County
+-74.6275 39.288333 SSS-NJ-CPM-010WL Cape May County
+-74.865556 38.936389 SSS-NJ-CPM-035WL Cape May County
+-74.865556 38.936389 SSS-NJ-CPM-035WV Cape May County
+-75.04055556 39.395278 SSS-NJ-CUM-020WL Cumberland County
+-75.23666667 39.429167 SSS-NJ-CUM-025WL Cumberland County
+-74.02317 40.74394 SSS-NJ-HUD-001WL Hudson County
+-74.06606 40.79982 SSS-NJ-HUD-002WL Hudson County
+-74.24687 40.45911 SSS-NJ-MID-001WL Middlesex County
+-74.166309 40.926465 SSS-NJ-PAS-001WL Passaic County
+-74.20512 40.64775 SSS-NJ-UNI-001WL Union County
+-74.27177 40.59952 SSS-NJ-UNI-002WL Union County
+-73.2630556 40.643333 403836073154775 Suffolk County
+-73.926474 40.800589 404810735538063 New York County
+-73.732617 40.94881 405658073433147 Westchester County
+-74.011612 40.579998 SSS-NY-KIN-001WL Kings County
+-73.988317 40.704581 SSS-NY-KIN-002WL Kings County
+-73.989839 40.676878 SSS-NY-KIN-003WL Kings County
+-73.530571 40.877911 SSS-NY-NAS-001WL Nassau County
+-73.640682 40.582752 SSS-NY-NAS-004WL Nassau County
+-73.458503 40.652383 SSS-NY-NAS-005WL Nassau County
+-73.5636111 40.8875 SSS-NY-NAS-006WL Nassau County
+-73.4633333 40.857222 SSS-NY-NAS-007WL Nassau County
+-73.7101944 40.866222 SSS-NY-NAS-008WL Nassau County
+-73.926331 40.877565 SSS-NY-NEW-001WL New York County
+-73.858278 40.762294 SSS-NY-QUE-001WL Queens County
+-73.836384 40.64533 SSS-NY-QUE-002WL Queens County
+-73.828785 40.796509 SSS-NY-QUE-004WL Queens County
+-73.822651 40.606152 SSS-NY-QUE-005WL Queens County
+-74.059845 40.593884 SSS-NY-RIC-001WL Richmond County
+-74.230339 40.501881 SSS-NY-RIC-003WL Richmond County
+-74.12768 40.54345 SSS-NY-RIC-004WL Richmond County
+-72.558281 41.012585 SSS-NY-SUF-001WL Suffolk County
+-72.863197 40.964375 SSS-NY-SUF-002WL Suffolk County
+-73.072273 40.946167 SSS-NY-SUF-003WL Suffolk County
+-72.750252 40.787121 SSS-NY-SUF-004WL Suffolk County
+-72.637741 40.916077 SSS-NY-SUF-005WL Suffolk County
+-72.502853 40.848869 SSS-NY-SUF-006WL Suffolk County
+-72.502998 40.893311 SSS-NY-SUF-008WL Suffolk County
+-72.290298 41.001972 SSS-NY-SUF-009WL Suffolk County
+-73.353035 40.900482 SSS-NY-SUF-011WL Suffolk County
+-72.470741 40.990695 SSS-NY-SUF-014WL Suffolk County
+-72.361443 41.10104 SSS-NY-SUF-015WL Suffolk County
+-73.202158 40.634734 SSS-NY-SUF-018WL Suffolk County
+-73.264861 40.659318 SSS-NY-SUF-019WL Suffolk County
+-73.01338 40.749179 SSS-NY-SUF-021WL Suffolk County
+-73.279903 40.685227 SSS-NY-SUF-022WL Suffolk County
+-72.189097 40.944283 SSS-NY-SUF-023WL Suffolk County
+-71.934378 41.073188 SSS-NY-SUF-024WL Suffolk County
+-72.855502 40.746867 SSS-NY-SUF-026WL Suffolk County
+-73.1503912 40.747598 SSS-NY-SUF-027WL Suffolk County
+-73.719828 40.942755 SSS-NY-WES-001WL Westchester County
+-73.78172 40.890385 SSS-NY-WES-003WL Westchester County
+-73.73236 40.94759 SSS-NY-WES-100WL Westchester County
+-75.37609 39.8328 SSS-PA-DEL-003WL Delaware County
+-75.30225 39.85918 SSS-PA-DEL-005WL Delaware County
+-75.22887 39.86531 SSS-PA-DEL-006WL Delaware County
+-75.00025 40.03425 SSS-PA-PHI-013WL Philadelphia County
+-75.20825 39.9338889 SSS-PA-PHI-014WL Philadelphia County
+-75.164222 39.88758333 SSS-PA-PHI-016WL Philadelphia County
+-71.449851 41.449111 412656071265946 Washington County
+-71.2859 41.72614 SSS-RI-BRI-013WL Bristol County
+-71.39166 41.68673 SSS-RI-KEN-011WL Kent County
+-71.24 41.61965 SSS-RI-NEW-014WL Newport County
+-71.19241 41.46496 SSS-RI-NEW-015WL Newport County
+-71.85914 41.31029 SSS-RI-WAS-001WL Washington County
+-71.60535 41.36532 SSS-RI-WAS-003WL Washington County
+-71.76663 41.33482 SSS-RI-WAS-005WL Washington County
+-71.64473 41.38102 SSS-RI-WAS-007WL Washington County
+-71.51472 41.37726 SSS-RI-WAS-008WL Washington County
+-71.41637 41.52809 SSS-RI-WAS-012WL Washington County
+-75.40668 37.90318 SSS-VA-ACC-001WL Accomack County
+-75.58983 37.73291 SSS-VA-ACC-002WL Accomack County
+-75.786703 37.721747 SSS-VA-ACC-003WL Accomack County
+-76.3172222222 37.0152777778 SSS-VA-HAM-002WL Hampton City
+-76.309926 37.492592 SSS-VA-MAT-001WL Mathews County
+-75.841713 37.444888 SSS-VA-NOR-001WL Northampton County
+-76.0162777778 37.2649166667 SSS-VA-NOR-003WL Northampton County
+-75.95017 37.127509 SSS-VA-NOR-004WL Northampton County
+-76.08825 36.9068333333 SSS-VA-VAB-001WL Virginia Beach City
+-76.319444 37.1106111 SSS-VA-YOR-003WL York County
+-73.1575 40.643161 SSS-NY-SUF-017WL Suffolk County
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_driver.xml b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_driver.xml
new file mode 100644
index 0000000000..765e605959
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_driver.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_forward.xml b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_forward.xml
new file mode 100644
index 0000000000..3b827b7394
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_forward.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ input.nc
+
+
+ input.nc
+
+
+ points.nc
+ input
+ initial_only
+ single_file
+ forward;analysis
+
+
+
+
+
+
+ 12:00:00
+
+
+
+
+
+
+
+
+
+
+
+
+ pointwiseStats.nc
+ output
+ forward;analysis
+ 00:30:00
+ pointwiseStatsAMPKG
+ truncate
+ single_file
+
+
+
+
+
+
+
+
+
+
+
+
+ 360
+
+
+
+
diff --git a/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_init.xml b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_init.xml
new file mode 100644
index 0000000000..f8ecf577c2
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/USDEQU120at30cr10rr2/sandy/config_init.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mesh.nc
+
+
+ mesh.nc
+ input
+ initial_only
+
+
+
+
+
+ output
+ 0000_00:00:01
+ truncate
+ ocean.nc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mesh.nc
+ USGS_stations.txt
+ NOAA-COOPS_stations.txt
+
+
+
+
+
diff --git a/testing_and_setup/compass/ocean/hurricane/concatenate_cfsr.py b/testing_and_setup/compass/ocean/hurricane/concatenate_cfsr.py
new file mode 100644
index 0000000000..1a82fec108
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/concatenate_cfsr.py
@@ -0,0 +1,21 @@
+import subprocess
+import os
+import glob
+
+pwd = os.getcwd()+'/'
+
+filetypes = ['prmsl','wnd10m']
+
+for ft in filetypes:
+
+ files = sorted(glob.glob(pwd+ft+'*.nc'))
+ print(files)
+
+ filenames = [f.split('/')[-1] for f in files]
+ print(filenames)
+
+ command = ['ncrcat']
+ command.extend(filenames)
+ command.append(ft+'.nc')
+ print(command)
+ subprocess.call(command)
diff --git a/testing_and_setup/compass/ocean/hurricane/create_pointstats_file.py b/testing_and_setup/compass/ocean/hurricane/create_pointstats_file.py
new file mode 100644
index 0000000000..d89a72bf49
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/create_pointstats_file.py
@@ -0,0 +1,96 @@
+import netCDF4
+import numpy as np
+from scipy import spatial
+import matplotlib.pyplot as plt
+import argparse
+plt.switch_backend('agg')
+
+######################################################################################
+######################################################################################
+
+def lonlat2xyz(lon,lat):
+
+ R = 6378206.4
+ x = R*np.multiply(np.cos(lon),np.cos(lat))
+ y = R*np.multiply(np.sin(lon),np.cos(lat))
+ z = R*np.sin(lat)
+
+ return x,y,z
+
+######################################################################################
+######################################################################################
+
+def create_pointstats_file(mesh_file,stations_files):
+
+ # Read in station locations
+ lon = []
+ lat = []
+ for stations_file in stations_files:
+ f = open(stations_file,'r')
+ lines = f.read().splitlines()
+ for line in lines:
+ lon.append(line.split()[0])
+ lat.append(line.split()[1])
+
+ # Convert station locations
+ lon = np.radians(np.array(lon,dtype=np.float32))
+ lon_idx, = np.where(lon < 0.0)
+ lon[lon_idx] = lon[lon_idx] + 2.0*np.pi
+ lat = np.radians(np.array(lat,dtype=np.float32))
+ stations = np.vstack((lon,lat)).T
+ #x,y,z = lonlat2xyz(lon,lat)
+ #stations = np.vstack((x,y,z)).T
+
+ # Read in cell center coordinates
+ mesh_nc = netCDF4.Dataset(mesh_file,'r')
+ lonCell = np.array(mesh_nc.variables["lonCell"][:])
+ latCell = np.array(mesh_nc.variables["latCell"][:])
+ meshCells = np.vstack((lonCell,latCell)).T
+ #x,y,z = lonlat2xyz(lonCell,latCell)
+ #meshCells = np.vstack((x,y,z)).T
+
+ # Find nearest cell center to each station
+ tree = spatial.KDTree(meshCells)
+ d,idx = tree.query(stations)
+
+ # Plot the station locations and nearest cell centers
+ plt.figure()
+ plt.plot(lonCell[idx],latCell[idx],'.')
+ plt.plot(lon,lat,'.')
+ plt.savefig('station_locations.png')
+
+ # Open netCDF file for writing
+ data_nc = netCDF4.Dataset('points.nc','w', format='NETCDF3_64BIT_OFFSET')
+
+ # Find dimesions
+ npts = idx.shape[0]
+ ncells = lonCell.shape[0]
+
+ # Declare dimensions
+ data_nc.createDimension('nCells',ncells)
+ data_nc.createDimension('StrLen',64)
+ data_nc.createDimension('nPoints',npts)
+
+ # Declear variables
+ npts = data_nc.dimensions['nPoints'].name
+ pnt_ids = data_nc.createVariable('pointCellGlobalID',np.int32,(npts,))
+
+ # Set variables
+ pnt_ids[:] = idx[:]
+ data_nc.close()
+
+######################################################################################
+######################################################################################
+
+if __name__ == '__main__':
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--mesh_file', help='file that contains the MPAS mesh information')
+ parser.add_argument('--station_files', action='append', help='list of files that contain station information')
+ args = parser.parse_args()
+
+ #mesh_file = 'culled_mesh.nc'
+ #stations_files= ['USGS_stations/stations_all.txt','NOAA-COOPS_stations/stations.txt']
+
+ create_pointstats_file(args.mesh_file,args.station_files)
+
diff --git a/testing_and_setup/compass/ocean/hurricane/interpolate_time_varying_forcing.py b/testing_and_setup/compass/ocean/hurricane/interpolate_time_varying_forcing.py
new file mode 100644
index 0000000000..ee1f0e7914
--- /dev/null
+++ b/testing_and_setup/compass/ocean/hurricane/interpolate_time_varying_forcing.py
@@ -0,0 +1,181 @@
+import netCDF4
+import matplotlib.pyplot as plt
+import numpy as np
+import glob
+import pprint
+import datetime
+import os
+import yaml
+import subprocess
+import argparse
+from mpl_toolkits.basemap import Basemap
+from scipy import interpolate
+plt.switch_backend('agg')
+
+##################################################################################################
+##################################################################################################
+
+def interpolate_data_to_grid(grid_file,data_file,var):
+
+ # Open files
+ data_nc = netCDF4.Dataset(data_file,'r')
+ grid_nc = netCDF4.Dataset(grid_file,'r')
+
+ # Get grid from data file
+ lon_data = data_nc.variables['lon'][:]
+ lon_data = np.append(lon_data,360.0)
+ lat_data = np.flipud(data_nc.variables['lat'][:])
+ time = data_nc.variables['time'][:]
+ nsnaps = time.size
+ nlon = lon_data.size
+ nlat = lat_data.size
+ data = np.zeros((nsnaps,nlat,nlon))
+ print(data.shape)
+
+ # Get grid from grid file
+ lon_grid = grid_nc.variables['lonCell'][:]*180.0/np.pi
+ lat_grid = grid_nc.variables['latCell'][:]*180.0/np.pi
+ grid_points = np.column_stack((lon_grid,lat_grid))
+ ncells = lon_grid.size
+ interp_data = np.zeros((nsnaps,ncells))
+ print(interp_data.shape)
+ print(np.amin(lon_grid),np.amax(lon_grid))
+ print(np.amin(lat_grid),np.amax(lat_grid))
+
+ # Interpolate timesnaps
+ for i,t in enumerate(time):
+ print('Interpolating '+var+': '+str(i))
+
+ # Get data to interpolate
+ data[i,:,0:-1] = np.flipud(data_nc.variables[var][i,:,:])
+ data[i,:,-1] = data[i,:,0]
+
+ # Interpolate data onto new grid
+ interpolator = interpolate.RegularGridInterpolator((lon_data,lat_data),data[i,:,:].T,bounds_error=False,fill_value=0.0)
+ interp_data[i,:] = interpolator(grid_points)
+
+ # Deal with time
+ ref_date = data_nc.variables['time'].getncattr('units').replace('hours since ','').replace('.0 +0:00','')
+ ref_date = datetime.datetime.strptime(ref_date,'%Y-%m-%d %H:%M:%S')
+ xtime = []
+ for t in time:
+ date = ref_date + datetime.timedelta(hours=np.float64(t))
+ xtime.append(date.strftime('%Y-%m-%d_%H:%M:%S'+45*' '))
+ xtime = np.array(xtime,'S64')
+
+ return lon_grid,lat_grid,interp_data,lon_data,lat_data,data,xtime
+
+##################################################################################################
+##################################################################################################
+
+def write_to_file(filename,data,var,xtime):
+
+ if os.path.isfile(filename):
+ data_nc = netCDF4.Dataset(filename,'a', format='NETCDF3_64BIT_OFFSET')
+ else:
+ data_nc = netCDF4.Dataset(filename,'w', format='NETCDF3_64BIT_OFFSET')
+
+ # Find dimesions
+ ncells = data.shape[1]
+ nsnaps = data.shape[0]
+
+ # Declare dimensions
+ data_nc.createDimension('nCells',ncells)
+ data_nc.createDimension('StrLen',64)
+ data_nc.createDimension('Time',None)
+
+ # Create time variable
+ time = data_nc.createVariable('xtime','S1',('Time','StrLen'))
+ time[:,:] = netCDF4.stringtochar(xtime)
+
+ # Set variables
+ data_var = data_nc.createVariable(var,np.float64,('Time','nCells'))
+ data_var[:,:] = data[:,:]
+ data_nc.close()
+
+##################################################################################################
+##################################################################################################
+
+def plot_interp_data(lon_data,lat_data,data,lon_grid,lat_grid,interp_data,var_label,var_abrev,time):
+
+ levels = np.linspace(np.amin(data),np.amax(data),10)
+
+ # Plot data
+ fig = plt.figure()
+ ax0 = fig.add_subplot(2,1,1)
+ cf = ax0.contourf(lon_data,lat_data,data,levels=levels)
+ m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,\
+ llcrnrlon=0,urcrnrlon=360,resolution='c')
+ m.fillcontinents(color='tan',lake_color='lightblue')
+ m.drawcoastlines()
+ ax0.set_title('data '+time.strip())
+ cbar = fig.colorbar(cf,ax=ax0)
+ cbar.set_label(var_label)
+
+ # Plot interpolated data
+ ax1 = fig.add_subplot(2,1,2)
+ cf = ax1.tricontourf(lon_grid,lat_grid,interp_data,levels=levels)
+ m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,\
+ llcrnrlon=0,urcrnrlon=360,resolution='c')
+ m.fillcontinents(color='tan',lake_color='lightblue')
+ m.drawcoastlines()
+ ax1.set_title('interpolated data '+time.strip())
+ cbar = fig.colorbar(cf,ax=ax1)
+ cbar.set_label(var_label)
+
+ # Save figure
+ fig.tight_layout()
+ fig.savefig(var_abrev+'_'+str(i).zfill(4)+'.png',box_inches='tight')
+ plt.close()
+
+##################################################################################################
+##################################################################################################
+
+if __name__ == '__main__':
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--plot',action='store_true')
+ args = parser.parse_args()
+
+ nplot = 10
+
+ # Files to interpolate to/from
+ grid_file = './mesh.nc'
+ wind_file = './wnd10m.nc'
+ pres_file = './prmsl.nc'
+ forcing_file = 'atmospheric_forcing.nc'
+
+ # Interpolation of u and v velocities
+ lon_grid,lat_grid,u_interp,lon_data,lat_data,u_data,xtime = interpolate_data_to_grid(grid_file,wind_file,'U_GRD_L103')
+ lon_grid,lat_grid,v_interp,lon_data,lat_data,v_data,xtime = interpolate_data_to_grid(grid_file,wind_file,'V_GRD_L103')
+
+ # Calculate and plot velocity magnitude
+ if args.plot:
+ for i in range(u_data.shape[0]):
+ if i % nplot == 0:
+
+ print('Plotting vel: '+str(i))
+
+ data = np.sqrt(np.square(u_data[i,:,:]) + np.square(v_data[i,:,:]))
+ interp_data = np.sqrt(np.square(u_interp[i,:]) + np.square(v_interp[i,:]))
+
+ plot_interp_data(lon_data,lat_data,data,lon_grid,lat_grid,interp_data,'velocity magnitude','vel',xtime[i])
+
+ # Interpolation of atmospheric pressure
+ lon_grid,lat_grid,p_interp,lon_data,lat_data,p_data,xtime = interpolate_data_to_grid(grid_file,pres_file,'PRMSL_L101')
+
+ # Plot atmopheric pressure
+ if args.plot:
+ for i in range(p_data.shape[0]):
+ if i % nplot == 0:
+
+ print('Plotting pres: '+str(i))
+
+ plot_interp_data(lon_data,lat_data,p_data[i,:,:],lon_grid,lat_grid,p_interp[i,:],'atmospheric pressure','pres',xtime[i])
+
+ # Write to NetCDF file
+ subprocess.call(['rm',forcing_file])
+ write_to_file(forcing_file,u_interp,'windSpeedU',xtime)
+ write_to_file(forcing_file,v_interp,'windSpeedV',xtime)
+ write_to_file(forcing_file,p_interp,'atmosPressure',xtime)
+
diff --git a/testing_and_setup/compass/ocean/jigsaw_to_MPAS/coastal_tools.py b/testing_and_setup/compass/ocean/jigsaw_to_MPAS/coastal_tools.py
index dd56fa291a..da9863edd6 100755
--- a/testing_and_setup/compass/ocean/jigsaw_to_MPAS/coastal_tools.py
+++ b/testing_and_setup/compass/ocean/jigsaw_to_MPAS/coastal_tools.py
@@ -107,6 +107,8 @@
[-68.7,81.24],
[-117.29,77.75]]),
np.array([-25.0,-10.0,62.5,67.5])]}
+Atlantic = {"include": [np.array([-78.5, -77.5, 23.5, 25.25])], # Bahamas, use with large transition start to fill Atlantic
+ "exclude": []}
# Combined coastlines
CONUS = {"include": [], "exclude": []}
@@ -182,6 +184,23 @@
[-161.81, 72.02],
[163.64, 73.70]])]}
+Atlantic_restrict = {"include": [np.array([[-86.39, 13.67],
+ [-24.44, 21.32],
+ [-50.09, 55.98],
+ [-105.58, 23.61]]),
+ np.array([[-76.39, 4.55],
+ [-30.74, -2.66],
+ [-30.83, 43.95],
+ [-94.99, 18.47]])],
+ "exclude": [np.array([[-80.72, 1.66],
+ [-73.70, 3.03],
+ [-78.94, 9.33],
+ [-84.98, 7.67]]),
+ np.array([[-100.18, 13.76],
+ [-82.93, 6.51],
+ [-85.08, 13.74],
+ [-95.86, 18.04]])]}
+
##########################################################################
# User-defined inputs
##########################################################################
diff --git a/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_bathymetry.py b/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_bathymetry.py
index fae3d0c9fc..b26e2f7136 100755
--- a/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_bathymetry.py
+++ b/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_bathymetry.py
@@ -33,11 +33,11 @@ def inject_bathymetry(mesh_file):
# Create new NetCDF variables in mesh file, if necessary
nc_vars = nc_mesh.variables.keys()
- if 'bathymetry' not in nc_vars:
- nc_mesh.createVariable('bathymetry', 'f8', ('nCells'))
+ if 'bottomDepthObserved' not in nc_vars:
+ nc_mesh.createVariable('bottomDepthObserved', 'f8', ('nCells'))
# Write to mesh file
- nc_mesh.variables['bathymetry'][:] = bathymetry
+ nc_mesh.variables['bottomDepthObserved'][:] = bathymetry
nc_mesh.close()
diff --git a/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_preserve_floodplain.py b/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_preserve_floodplain.py
index 95d9b2a14a..bfb10f73e5 100755
--- a/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_preserve_floodplain.py
+++ b/testing_and_setup/compass/ocean/jigsaw_to_MPAS/inject_preserve_floodplain.py
@@ -15,7 +15,7 @@ def inject_preserve_floodplain(mesh_file, floodplain_elevation):
if 'cellSeedMask' not in nc_vars:
nc_mesh.createVariable('cellSeedMask', 'i', ('nCells'))
nc_mesh.variables['cellSeedMask'][:] = \
- nc_mesh.variables['bathymetry'][:] < floodplain_elevation
+ nc_mesh.variables['bottomDepthObserved'][:] < floodplain_elevation
nc_mesh.close()