From a93f78db8a4c044c69b15a849b860d3d928da7d5 Mon Sep 17 00:00:00 2001 From: Steven Brus Date: Mon, 8 Apr 2019 15:21:21 -0600 Subject: [PATCH 1/3] Add Greenland to NAEC60to30cr8 mesh and update coastal_tools.py - Add resolution around entire coast of Greenland - Fill in divot in resolution near Labrador Sea. This required a new parameter "point_list" in the coastal_tools default_params dictionary. This is a list of coordinates which act as user-specified coastline points when calculating the cell width distance function. In this case, a single point adds a circle of high resolution. - Make specifying the bathymetry dataset used to extract coastlines more flexible. A new parameter "nc_vars" in the default_params dictionary is a list of the variable names used in the netCDF file for lon, lat and bathy. --- .../NAEC60to30cr8/init/define_base_mesh.py | 16 ++++++--- .../ocean/jigsaw_to_MPAS/coastal_tools.py | 34 ++++++++++++++++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/define_base_mesh.py b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/define_base_mesh.py index 1b704d8e61..8f1850bb13 100755 --- a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/define_base_mesh.py +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/define_base_mesh.py @@ -91,11 +91,18 @@ def cellWidthVsLatLon(): cell_width,lon,lat = ct.coastal_refined_mesh(params,cell_width,lon,lat) print "***Greenland***" - Greenland = {"include":[np.array([-49,-45,60,61])], - "exclude":[]} - params["region_box"] = Greenland + params["region_box"] = ct.Greenland params["restrict_box"] = ct.Empty - params["trans_start"] = 900.0*km + params["trans_width"] = 600.0*km + params["trans_start"] = 275.0*km + cell_width, lon, lat = ct.coastal_refined_mesh(params,cell_width,lon,lat) + + print "***Labrador Sea***" + params["region_box"] = ct.Empty + params["restrict_box"] = ct.Empty + params["point_list"] = [np.array([-50.0,55.0])] + 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"***Central America (West Coast)***" @@ -114,6 +121,7 @@ def cellWidthVsLatLon(): "exclude":[]} params["region_box"] = Central_America params["restrict_box"] = ct.Empty + params["point_list"] = None 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) 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 8cf5656aad..e9959208c4 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 @@ -94,6 +94,20 @@ Aleutian_Islands_W = {"include": [np.array([164.9, 180.0, 50.77, 56.31])], "exclude": [np.array([178.5, 179.5, 51.25, 51.75])]} +Greenland = {"include":[np.array([-81.5,-12.5,60,85])], + "exclude":[np.array([[-87.6,58.7], + [-51.9,56.6], + [-68.9,75.5], + [-107.0,73.3]]), + np.array([[-119.0,74.5], + [-92.7,75.9], + [-52.84,83.25], + [-100.8,84.0]]), + np.array([[-101.3,68.5], + [-82.4,72.3], + [-68.7,81.24], + [-117.29,77.75]]), + np.array([-25.0,-10.0,62.5,67.5])]} # Combined coastlines CONUS = {"include": [], "exclude": []} @@ -177,6 +191,7 @@ # Path to bathymetry data and name of file "nc_file": "./earth_relief_15s.nc", + "nc_vars": ["lon","lat","z"], # Bounding box of coastal refinement region "region_box": Continental_US, @@ -187,6 +202,7 @@ "z_contour": 0.0, "n_longest": 10, "smooth_coastline": 0, + "point_list": None, # Global mesh parameters "grd_box": Entire_Globe, @@ -235,9 +251,11 @@ def coastal_refined_mesh(params, cell_width=None, lon_grd=None, lat_grd=None): # Get coastlines from bathy/topo data set coastlines = extract_coastlines( params["nc_file"], + params["nc_vars"], params["region_box"], params["z_contour"], params["n_longest"], + params["point_list"], params["plot_option"], params["plot_box"], call_count) @@ -331,7 +349,7 @@ def create_background_mesh(grd_box, ddeg, mesh_type, dx_min, dx_max, # {{{ ############################################################## -def extract_coastlines(nc_file, region_box, z_contour=0, n_longest=10, # {{{ +def extract_coastlines(nc_file, nc_vars, region_box, z_contour=0, n_longest=10, point_list=None, # {{{ plot_option=False, plot_box=[], call=None): print "Extract coastlines" @@ -339,9 +357,9 @@ def extract_coastlines(nc_file, region_box, z_contour=0, n_longest=10, # {{{ # Open NetCDF file and read cooordintes nc_fid = Dataset(nc_file, "r") - lon = nc_fid.variables['lon'][:] - lat = nc_fid.variables['lat'][:] - bathy_data = nc_fid.variables['z'] + lon = nc_fid.variables[nc_vars[0]][:] + lat = nc_fid.variables[nc_vars[1]][:] + bathy_data = nc_fid.variables[nc_vars[2]] # Get coastlines for refined region coastline_list = [] @@ -388,6 +406,14 @@ def extract_coastlines(nc_file, region_box, z_contour=0, n_longest=10, # {{{ print " Done" + # Add in user-specified points + if point_list: + for i,points in enumerate(point_list): + cpad = np.vstack((points, [np.nan, np.nan])) + coastline_list.append(cpad) + + + # Combine coastlines coastlines = np.concatenate(coastline_list) From eea24b384ef57b43074dce2ca0c636c44989d1b4 Mon Sep 17 00:00:00 2001 From: Mark Petersen Date: Wed, 10 Apr 2019 08:27:04 -0600 Subject: [PATCH 2/3] remove source_path=jigsaw_to_MPAS to subdirectory of mpas_model --- .../compass/general.config.ocean | 1 - .../NAEC60to30cr8/init/config_base_mesh.xml | 16 ++++++------- .../init/config_base_mesh.xml | 13 +++++----- .../init/config_base_mesh.xml | 12 +++++----- .../config_files/config_mesh_metrics.xml | 24 +++++++++---------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/testing_and_setup/compass/general.config.ocean b/testing_and_setup/compass/general.config.ocean index 10790c2855..f79372af38 100644 --- a/testing_and_setup/compass/general.config.ocean +++ b/testing_and_setup/compass/general.config.ocean @@ -48,4 +48,3 @@ jigsaw-geo-matlab = FULL_PATH_TO_JIGSAW_REPO mesh_database = FULL_PATH_TO_LOCAL_MESH_DATABASE initial_condition_database = FULL_PATH_TO_LOCAL_INITIAL_CONDITION_DATABASE bathymetry_database = FULL_PATH_TO_BATHYMETRY_DATABASE -jigsaw_to_MPAS = FULL_PATH_TO_MPAS_MODEL_REPORT/testing_and_setup/compass/ocean/jigsaw_to_MPAS diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/config_base_mesh.xml b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/config_base_mesh.xml index d1ae0a9ebf..8e5cd04171 100644 --- a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/config_base_mesh.xml +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8/init/config_base_mesh.xml @@ -4,16 +4,16 @@ - - - - - - - + + + + + + + - + diff --git a/testing_and_setup/compass/ocean/global_ocean/USDEQU120cr10rr1/init/config_base_mesh.xml b/testing_and_setup/compass/ocean/global_ocean/USDEQU120cr10rr1/init/config_base_mesh.xml index 94f449fd8a..37f4105c26 100755 --- a/testing_and_setup/compass/ocean/global_ocean/USDEQU120cr10rr1/init/config_base_mesh.xml +++ b/testing_and_setup/compass/ocean/global_ocean/USDEQU120cr10rr1/init/config_base_mesh.xml @@ -4,14 +4,15 @@ - - - - - + + + + + - + + diff --git a/testing_and_setup/compass/ocean/global_ocean/USDEQU300cr20rr3/init/config_base_mesh.xml b/testing_and_setup/compass/ocean/global_ocean/USDEQU300cr20rr3/init/config_base_mesh.xml index 94f449fd8a..acd2a0c23d 100755 --- a/testing_and_setup/compass/ocean/global_ocean/USDEQU300cr20rr3/init/config_base_mesh.xml +++ b/testing_and_setup/compass/ocean/global_ocean/USDEQU300cr20rr3/init/config_base_mesh.xml @@ -4,14 +4,14 @@ - - - - - + + + + + - + diff --git a/testing_and_setup/compass/ocean/global_ocean/config_files/config_mesh_metrics.xml b/testing_and_setup/compass/ocean/global_ocean/config_files/config_mesh_metrics.xml index b698471f63..4639185150 100755 --- a/testing_and_setup/compass/ocean/global_ocean/config_files/config_mesh_metrics.xml +++ b/testing_and_setup/compass/ocean/global_ocean/config_files/config_mesh_metrics.xml @@ -2,16 +2,16 @@ - + - + - - + + @@ -19,14 +19,14 @@ - - - - - - - - + + + + + + + + From 50b204bc419d0ba285c06d2f2252cd03a99cf305 Mon Sep 17 00:00:00 2001 From: Steven Brus Date: Wed, 10 Apr 2019 11:02:01 -0600 Subject: [PATCH 3/3] Add 60 layer version of NAEC60to30cr8 --- .../init/config_base_mesh.xml | 23 ++++++++ .../init/config_culled_mesh.xml | 1 + .../NAEC60to30cr8L60/init/config_driver.xml | 1 + .../init/config_initial_state.xml | 1 + .../init/config_mesh_metrics.xml | 1 + .../NAEC60to30cr8L60/init/define_base_mesh.py | 1 + .../spin_up/config_driver.xml | 28 +++++++++ .../spin_up/config_spin_up1.xml | 49 ++++++++++++++++ .../spin_up/config_spin_up2.xml | 53 +++++++++++++++++ .../spin_up/config_spin_up3.xml | 53 +++++++++++++++++ .../spin_up/config_spin_up4.xml | 53 +++++++++++++++++ .../spin_up/config_spin_up5.xml | 53 +++++++++++++++++ .../spin_up/config_spin_up6.xml | 51 +++++++++++++++++ .../spin_up/config_test_final_settings.xml | 47 +++++++++++++++ .../NAEC60to30cr8L60/template_forward.xml | 17 ++++++ .../config_initial_state_60_layers.xml | 57 +++++++++++++++++++ 16 files changed, 489 insertions(+) create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_base_mesh.xml create mode 120000 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_culled_mesh.xml create mode 120000 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_driver.xml create mode 120000 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_initial_state.xml create mode 120000 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_mesh_metrics.xml create mode 120000 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/define_base_mesh.py create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_driver.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_spin_up1.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_spin_up2.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_spin_up3.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_spin_up4.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_spin_up5.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_spin_up6.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_test_final_settings.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/template_forward.xml create mode 100644 testing_and_setup/compass/ocean/global_ocean/config_files/config_initial_state_60_layers.xml diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_base_mesh.xml b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_base_mesh.xml new file mode 100644 index 0000000000..8e5cd04171 --- /dev/null +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_base_mesh.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_culled_mesh.xml b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_culled_mesh.xml new file mode 120000 index 0000000000..9c49ba6246 --- /dev/null +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_culled_mesh.xml @@ -0,0 +1 @@ +../../config_files/config_culled_mesh.xml \ No newline at end of file diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_driver.xml b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_driver.xml new file mode 120000 index 0000000000..6e64036436 --- /dev/null +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_driver.xml @@ -0,0 +1 @@ +../../config_files/config_driver_init.xml \ No newline at end of file diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_initial_state.xml b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_initial_state.xml new file mode 120000 index 0000000000..708f1da2f9 --- /dev/null +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_initial_state.xml @@ -0,0 +1 @@ +../../config_files/config_initial_state_60_layers.xml \ No newline at end of file diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_mesh_metrics.xml b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_mesh_metrics.xml new file mode 120000 index 0000000000..1d71c75ff0 --- /dev/null +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/config_mesh_metrics.xml @@ -0,0 +1 @@ +../../config_files/config_mesh_metrics.xml \ No newline at end of file diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/define_base_mesh.py b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/define_base_mesh.py new file mode 120000 index 0000000000..2711c3e7f8 --- /dev/null +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/init/define_base_mesh.py @@ -0,0 +1 @@ +../../NAEC60to30cr8/init/define_base_mesh.py \ No newline at end of file diff --git a/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_driver.xml b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_driver.xml new file mode 100644 index 0000000000..411b5a2fba --- /dev/null +++ b/testing_and_setup/compass/ocean/global_ocean/NAEC60to30cr8L60/spin_up/config_driver.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + +