Difference between revisions of "UCVM shakeout2 velocity model"
(→plots) |
|||
| (9 intermediate revisions by the same user not shown) | |||
| Line 7: | Line 7: | ||
a customized z coordinates list is pre-defined | a customized z coordinates list is pre-defined | ||
| + | four corners: | ||
| − | == Creating the | + | <pre> |
| + | |||
| + | Mesh dimensions: 516 x 468 x 152 | ||
| + | |||
| + | Grid 4 corners: | ||
| + | -120.028425 31.874269 | ||
| + | -114.584135 31.887394 | ||
| + | -120.181534 36.079919 | ||
| + | -114.461905 36.095287 | ||
| + | |||
| + | </pre> | ||
| + | |||
| + | == Creating the Data files with ucvm2mesh == | ||
UCVM's ucvm2mesh is used to generate 3 binary mesh data files: vs, vp and density for ROI | UCVM's ucvm2mesh is used to generate 3 binary mesh data files: vs, vp and density for ROI | ||
| Line 36: | Line 49: | ||
# Gridding cell: CENTER or VERTEX | # Gridding cell: CENTER or VERTEX | ||
| − | gridtype= | + | gridtype=CENTER |
# Spacing of cells (m) | # Spacing of cells (m) | ||
| Line 47: | Line 60: | ||
# format: 1 row 1 target depth | # format: 1 row 1 target depth | ||
z_file = so2_zlist | z_file = so2_zlist | ||
| + | |||
| + | # (optional) output latitudes filename | ||
| + | y_file = so2_ylist | ||
| + | |||
| + | # (optional) output longitudes filename | ||
| + | x_file = so2_xlist | ||
# Projection | # Projection | ||
| Line 94: | Line 113: | ||
ucvm2mesh z depths list: | ucvm2mesh z depths list: | ||
| − | [[Media:so2_zlist| | + | [[Media:so2_zlist.txt|so2_zlist]] |
latitude coordinate list: | latitude coordinate list: | ||
| − | [[Media:so2_xlist| | + | [[Media:so2_xlist.txt|so2_xlist]] |
longitude coordinate list: | longitude coordinate list: | ||
| − | [[Media:so2_ylist| | + | [[Media:so2_ylist.txt|so2_ylist]] |
| + | |||
| + | |||
| + | ucvm2mesh command used: | ||
| + | <pre> | ||
| + | ucvm2mesh -f so2.conf > so2.out 2>&1 | ||
| + | |||
| + | and if so2.grid is known, | ||
| + | |||
| + | ucvm2mesh -f so2.conf -g so2.grid > so2.out 2>&1 | ||
| + | |||
| + | </pre> | ||
| + | |||
| + | == Create NetCDF mesh data == | ||
| + | |||
| + | make_nc.py | ||
| + | |||
| + | <pre> | ||
| + | #!/usr/bin/env python3 | ||
| + | |||
| + | import numpy as np | ||
| + | from netCDF4 import Dataset | ||
| + | |||
| + | ## Update filenames to match your local paths | ||
| + | file_zlist = "so2_zlist" | ||
| + | file_ylist = "so2_ylist" | ||
| + | file_xlist = "so2_xlist" | ||
| + | |||
| + | file_vp = "so2.mesh_vp" | ||
| + | file_vs = "so2.mesh_vs" | ||
| + | file_rho = "so2.mesh_rho" | ||
| + | |||
| + | output_nc = "model_CVMSI_taper_so2.nc" | ||
| + | |||
| + | ## Read ASCII coordinate files | ||
| + | zlist = np.loadtxt(file_zlist, dtype=np.float32) | ||
| + | ylist = np.loadtxt(file_ylist, dtype=np.float32) | ||
| + | xlist = np.loadtxt(file_xlist, dtype=np.float32) | ||
| + | |||
| + | # Extract dimension sizes dynamically from coordinate lists | ||
| + | n_depth = len(zlist) # Expecting 210 | ||
| + | n_lat = len(ylist) # Expecting 1251 | ||
| + | n_lon = len(xlist) # Expecting 1301 | ||
| + | |||
| + | print(f"n_depth is '{n_depth}'") | ||
| + | print(f"n_lat is '{n_lat}'") | ||
| + | print(f"n_lon is '{n_lon}'") | ||
| + | |||
| + | ## Read raw binary 3D data files and reshape to (depth, latitude, longitude) | ||
| + | # Note: Adjust byteorder if needed (e.g., dtype='>f4' for big-endian) | ||
| + | vp_data = np.fromfile(file_vp, dtype=np.float32).reshape((n_depth, n_lat, n_lon)) | ||
| + | vs_data = np.fromfile(file_vs, dtype=np.float32).reshape((n_depth, n_lat, n_lon)) | ||
| + | rho_data = np.fromfile(file_rho, dtype=np.float32).reshape((n_depth, n_lat, n_lon)) | ||
| + | vp_cnt = vp_data.size | ||
| + | vs_cnt = vs_data.size | ||
| + | rho_cnt = rho_data.size | ||
| + | |||
| + | print(f"vp_cnt is '{vp_cnt}'") | ||
| + | print(f"vs_cnt is '{vs_cnt}'") | ||
| + | print(f"rho_cnt is '{rho_cnt}'") | ||
| + | |||
| + | #print(f"vs..'{vs_data[100][100][100]}'") | ||
| + | |||
| + | ## Create and write NetCDF4 dataset | ||
| + | with Dataset(output_nc, mode="w", format="NETCDF4") as ncfile: | ||
| + | |||
| + | # Define dimensions | ||
| + | ncfile.createDimension("depth", n_depth) | ||
| + | ncfile.createDimension("latitude", n_lat) | ||
| + | ncfile.createDimension("longitude", n_lon) | ||
| + | |||
| + | # Define coordinate variables | ||
| + | var_depth = ncfile.createVariable("depth", "f4", ("depth",), fill_value=np.nan) | ||
| + | var_depth.units = "meters" | ||
| + | |||
| + | var_lat = ncfile.createVariable("latitude", "f4", ("latitude",), fill_value=np.nan) | ||
| + | var_lat.units = "degrees_north" | ||
| + | var_lon = ncfile.createVariable("longitude", "f4", ("longitude",), fill_value=np.nan) | ||
| + | var_lon.units = "degrees_east" | ||
| + | # Define 3D data variables | ||
| + | var_vp = ncfile.createVariable("vp", "f4", ("depth", "latitude", "longitude"), fill_value=np.nan) | ||
| + | var_vp.units = "m/s" | ||
| + | var_vs = ncfile.createVariable("vs", "f4", ("depth", "latitude", "longitude"), fill_value=np.nan) | ||
| + | var_vs.units = "m/s" | ||
| − | + | var_rho = ncfile.createVariable("rho", "f4", ("depth", "latitude", "longitude"), fill_value=np.nan) | |
| + | var_rho.units = "kg/m^3" | ||
| + | |||
| + | # Assign values | ||
| + | var_depth[:] = zlist | ||
| + | var_lat[:] = ylist | ||
| + | var_lon[:] = xlist | ||
| + | |||
| + | var_vp[:] = vp_data | ||
| + | var_vs[:] = vs_data | ||
| + | var_rho[:] = rho_data | ||
| + | |||
| + | ## All done | ||
| + | print(f"NetCDF file '{output_nc}' successfully written.") | ||
| + | </pre> | ||
| + | |||
| + | == plots == | ||
| + | |||
| + | shakeout2, horizontal vs slice at 0m, 200m, 700m | ||
| + | {| | ||
| + | | [[FILE:shakeout2_0m.png|thumb|400px|shakeout2 0m]] | ||
| + | | [[FILE:shakeout2_200m.png|thumb|400px|shakeout2 200m]] | ||
| + | | [[FILE:shakeout2_700m.png|thumb|400px|shakeout2 700m]] | ||
| + | |} | ||
| + | |||
| + | cvmsi, horizontal vs slice at 0m, 200m, 700m | ||
| + | {| | ||
| + | | [[FILE:shakeout2_cvmsi_0m.png|thumb|400px|cvmsi 0m]] | ||
| + | | [[FILE:shakeout2_cvmsi_200m.png|thumb|400px|cvmsi 200m]] | ||
| + | | [[FILE:shakeout2_cvmsi_700m.png|thumb|400px|cvmsi 700m]] | ||
| + | |} | ||
| + | |||
| + | |||
| + | shakeout2, within basin | ||
| + | {| | ||
| + | | [[FILE:shakeout2_profile_in0.png|thumb|400px|shakeout2 profile in0]] | ||
| + | | [[FILE:shakeout2_profile_in1.png|thumb|400px|shakeout2 profile in1]] | ||
| + | | [[FILE:shakeout2_profile_in2.png|thumb|400px|shakeout2 profile in2]] | ||
| + | |} | ||
| + | |||
| + | shakeout2, outside of basin | ||
| + | {| | ||
| + | | [[FILE:shakeout2_profile_out0.png|thumb|400px|shakeout2 profile out0]] | ||
| + | | [[FILE:shakeout2_profile_out1.png|thumb|400px|shakeout2 profile out1]] | ||
| + | | [[FILE:shakeout2_profile_out2.png|thumb|400px|shakeout2 profile out2]] | ||
| + | |} | ||
| + | |||
| + | cvmsi, within basin | ||
| + | {| | ||
| + | | [[FILE:shakeout2_cvmsi_profile_in0.png|thumb|400px|cvmsi profile in0]] | ||
| + | | [[FILE:shakeout2_cvmsi_profile_in1.png|thumb|400px|cvmsi profile in1]] | ||
| + | | [[FILE:shakeout2_cvmsi_profile_in2.png|thumb|400px|cvmsi profile in2]] | ||
| + | |} | ||
| + | |||
| + | cvmsi, outside of basin | ||
| + | {| | ||
| + | | [[FILE:shakeout2_cvmsi_profile_out0.png|thumb|400px|cvmsi profile out0]] | ||
| + | | [[FILE:shakeout2_cvmsi_profile_out1.png|thumb|400px|cvmsi profile out1]] | ||
| + | | [[FILE:shakeout2_cvmsi_profile_out2.png|thumb|400px|cvmsi profile out2]] | ||
| + | |} | ||
== Related Links == | == Related Links == | ||
*[[Main Page]] | *[[Main Page]] | ||
*[[UCVM]] | *[[UCVM]] | ||
Latest revision as of 00:38, 6 October 2026
Contents
Model overview
The shakeout2 velocity model for the ShakeOut Scenario 2.0 is based on CVM-S4.26.M01(with embedded GTL layer for basin regions) and GTL Tapering for all non-basin area.
Tapering's z range is from 0m to 700m, and material property floors used are vs=200m, vp=500m and density=200m a customized z coordinates list is pre-defined
four corners:
Mesh dimensions: 516 x 468 x 152 Grid 4 corners: -120.028425 31.874269 -114.584135 31.887394 -120.181534 36.079919 -114.461905 36.095287
Creating the Data files with ucvm2mesh
UCVM's ucvm2mesh is used to generate 3 binary mesh data files: vs, vp and density for ROI
In 'debug mode', 3 coordinate lists are created: one for the lats, the lons and the z depths.
With these data files and lists, a simple NetCDF file is created
ucvm2mesh configuration file:
# List of CVMs to query ucvmlist=cvmsi,elygtl:taper # (optional) zranges: -Z zmin,zmax min_zrange=0.0 max_zrange=700.0 # (optional) floors: -L vs_floor,vp_floor,density_floor vs_floor=200.0 vp_floor=500.0 density_floor=200.0 # UCVM conf file ucvmconf=YOUR_UCVM_INSTALL_PATH/conf/ucvm.conf # Gridding cell: CENTER or VERTEX gridtype=CENTER # Spacing of cells (m) spacing=1000.0 # (optional) Spacing of z depth (m) # if not set, z_spacing = spacing #z_spacing = 500.0 # (optional) Allow varying z depth # format: 1 row 1 target depth z_file = so2_zlist # (optional) output latitudes filename y_file = so2_ylist # (optional) output longitudes filename x_file = so2_xlist # Projection proj=+proj=utm +datum=WGS84 +zone=11 #to rotate, rot=-39.9 rot=0 # Origin # x,y: latlon # z: depth (m) x0=-120.033556 y0=31.869638 z0=0.0 # Number of cells along each dim nx=516 ny=468 nz=152 # how to determine distance in meter for each dim # x = nx * spacing # y = ny * spacing # z = nz * (spacing or z_spacing), or = z_file[idx]) # Partitioning of grid among processors # relevant to chunking, should be divisible into nx,ny,nz px=2 py=2 pz=2 # Vs/Vp minimum vp_min=0 vs_min=0 # Mesh grid files meshfile=so2.media gridfile=so2.grid # Mesh Grid formats # IJK-12, IJK-20, IJK-32 : single triplet file # SORD : separate vs, vp, rho files meshtype=SORD # Location of scratch dir scratch=./scratch
ucvm2mesh z depths list: so2_zlist
latitude coordinate list: so2_xlist
longitude coordinate list: so2_ylist
ucvm2mesh command used:
ucvm2mesh -f so2.conf > so2.out 2>&1 and if so2.grid is known, ucvm2mesh -f so2.conf -g so2.grid > so2.out 2>&1
Create NetCDF mesh data
make_nc.py
#!/usr/bin/env python3
import numpy as np
from netCDF4 import Dataset
## Update filenames to match your local paths
file_zlist = "so2_zlist"
file_ylist = "so2_ylist"
file_xlist = "so2_xlist"
file_vp = "so2.mesh_vp"
file_vs = "so2.mesh_vs"
file_rho = "so2.mesh_rho"
output_nc = "model_CVMSI_taper_so2.nc"
## Read ASCII coordinate files
zlist = np.loadtxt(file_zlist, dtype=np.float32)
ylist = np.loadtxt(file_ylist, dtype=np.float32)
xlist = np.loadtxt(file_xlist, dtype=np.float32)
# Extract dimension sizes dynamically from coordinate lists
n_depth = len(zlist) # Expecting 210
n_lat = len(ylist) # Expecting 1251
n_lon = len(xlist) # Expecting 1301
print(f"n_depth is '{n_depth}'")
print(f"n_lat is '{n_lat}'")
print(f"n_lon is '{n_lon}'")
## Read raw binary 3D data files and reshape to (depth, latitude, longitude)
# Note: Adjust byteorder if needed (e.g., dtype='>f4' for big-endian)
vp_data = np.fromfile(file_vp, dtype=np.float32).reshape((n_depth, n_lat, n_lon))
vs_data = np.fromfile(file_vs, dtype=np.float32).reshape((n_depth, n_lat, n_lon))
rho_data = np.fromfile(file_rho, dtype=np.float32).reshape((n_depth, n_lat, n_lon))
vp_cnt = vp_data.size
vs_cnt = vs_data.size
rho_cnt = rho_data.size
print(f"vp_cnt is '{vp_cnt}'")
print(f"vs_cnt is '{vs_cnt}'")
print(f"rho_cnt is '{rho_cnt}'")
#print(f"vs..'{vs_data[100][100][100]}'")
## Create and write NetCDF4 dataset
with Dataset(output_nc, mode="w", format="NETCDF4") as ncfile:
# Define dimensions
ncfile.createDimension("depth", n_depth)
ncfile.createDimension("latitude", n_lat)
ncfile.createDimension("longitude", n_lon)
# Define coordinate variables
var_depth = ncfile.createVariable("depth", "f4", ("depth",), fill_value=np.nan)
var_depth.units = "meters"
var_lat = ncfile.createVariable("latitude", "f4", ("latitude",), fill_value=np.nan)
var_lat.units = "degrees_north"
var_lon = ncfile.createVariable("longitude", "f4", ("longitude",), fill_value=np.nan)
var_lon.units = "degrees_east"
# Define 3D data variables
var_vp = ncfile.createVariable("vp", "f4", ("depth", "latitude", "longitude"), fill_value=np.nan)
var_vp.units = "m/s"
var_vs = ncfile.createVariable("vs", "f4", ("depth", "latitude", "longitude"), fill_value=np.nan)
var_vs.units = "m/s"
var_rho = ncfile.createVariable("rho", "f4", ("depth", "latitude", "longitude"), fill_value=np.nan)
var_rho.units = "kg/m^3"
# Assign values
var_depth[:] = zlist
var_lat[:] = ylist
var_lon[:] = xlist
var_vp[:] = vp_data
var_vs[:] = vs_data
var_rho[:] = rho_data
## All done
print(f"NetCDF file '{output_nc}' successfully written.")
plots
shakeout2, horizontal vs slice at 0m, 200m, 700m
File:Shakeout2 0m.png shakeout2 0m |
File:Shakeout2 200m.png shakeout2 200m |
File:Shakeout2 700m.png shakeout2 700m |
cvmsi, horizontal vs slice at 0m, 200m, 700m
File:Shakeout2 cvmsi 0m.png cvmsi 0m |
File:Shakeout2 cvmsi 200m.png cvmsi 200m |
File:Shakeout2 cvmsi 700m.png cvmsi 700m |
shakeout2, within basin
File:Shakeout2 profile in0.png shakeout2 profile in0 |
File:Shakeout2 profile in1.png shakeout2 profile in1 |
File:Shakeout2 profile in2.png shakeout2 profile in2 |
shakeout2, outside of basin
File:Shakeout2 profile out0.png shakeout2 profile out0 |
File:Shakeout2 profile out1.png shakeout2 profile out1 |
File:Shakeout2 profile out2.png shakeout2 profile out2 |
cvmsi, within basin
File:Shakeout2 cvmsi profile in0.png cvmsi profile in0 |
File:Shakeout2 cvmsi profile in1.png cvmsi profile in1 |
File:Shakeout2 cvmsi profile in2.png cvmsi profile in2 |
cvmsi, outside of basin
File:Shakeout2 cvmsi profile out0.png cvmsi profile out0 |
File:Shakeout2 cvmsi profile out1.png cvmsi profile out1 |
File:Shakeout2 cvmsi profile out2.png cvmsi profile out2 |