Skip to content

Commit

Permalink
Final merge ICOGS3D branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jreniel committed May 22, 2021
2 parents 5fa3c83 + 858f460 commit 473827d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pyschism/forcing/hycom/hycom2schism.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,11 @@ def fetch_data(self, outdir: Union[str, os.PathLike], hgrid, vgrid, start_date,
dst['map_to_global_node'][:] = include+1

dst.createVariable('tracer_concentration', 'f', ('time', 'node', 'nLevels', 'one'))
<<<<<<< HEAD
dst['tracer_concentration'][:, :, :, :] = timeseries_s
=======
dst['tracer_concentration'][:,:,:,:] = timeseries_s
>>>>>>> origin/ICOGS3D

with Dataset(outdir / 'TEM_nu.nc', 'w', format='NETCDF4') as dst:
# dimensions
Expand All @@ -346,9 +350,13 @@ def fetch_data(self, outdir: Union[str, os.PathLike], hgrid, vgrid, start_date,
dst['map_to_global_node'][:] = include+1

dst.createVariable('tracer_concentration', 'f', ('time', 'node', 'nLevels', 'one'))
<<<<<<< HEAD
dst['tracer_concentration'][:, :, :, :] = timeseries_t

print(f'Writing *_nu.nc takes {time()-t0} seconds')
=======
dst['tracer_concentration'][:,:,:,:] = timeseries_t
>>>>>>> origin/ICOGS3D


class InitialTS():
Expand Down
17 changes: 17 additions & 0 deletions pyschism/mesh/fgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def __init__(self, *argv, **kwargs):
def linear_with_depth(
cls,
hgrid: Union[str, os.PathLike, Gr3],
<<<<<<< HEAD
depth1: float = -1.0, # Are depth1 and depth2 positive up or positive down?
depth2: float = -3.0,
bfric_river: float = 0.0025,
Expand All @@ -151,6 +152,22 @@ def linear_with_depth(

values = (bfric_river + (depth1 + hgrid.values) *
(bfric_land - bfric_river) / (depth1-depth2))
=======
depth1: float = -1.0,
depth2: float = -3.0,
bfric_river: float = 0.0025,
bfric_land: float = 0.025):

obj = cls.constant(hgrid, np.nan)

'''
Note: pyschism treated bathymetry as negative in the water,
postive on the land. So here we have to negative the depth
value depth1 - (-hgrid.values)
'''
values = (bfric_river + (depth1+hgrid.values) \
* (bfric_land-bfric_river)/(depth1-depth2))
>>>>>>> origin/ICOGS3D

values[values > bfric_land] = bfric_land
values[values < bfric_river] = bfric_river
Expand Down

0 comments on commit 473827d

Please sign in to comment.