Skip to content

Commit

Permalink
update online docs: pyschism
Browse files Browse the repository at this point in the history
  • Loading branch information
cuill committed Sep 21, 2023
1 parent 9103447 commit 871ec1d
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 29 deletions.
67 changes: 67 additions & 0 deletions docs/getting-started/pre-processing-with-pyschism/bctides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#**Bctides**
Please refer to [this page](https://schism-dev.github.io/schism/master/input-output/bctides.html) for detailed horizontal B.C. and nudging options supported by SCHISM.

PySCHISM supports both TPXO and FES2014 tidal database. Please download the data (you may need to register) and save it as:

For TPXO:
~/.local/share/tpxo/

For FES2014:
~/.local/share/fes2014/eastward_velocity/
~/.local/share/fes2014/northward_velocity/
~/.local/share/fes2014/ocean_tide_extrapolated/

Generating *bctides.in*:
```python
from datetime import datetime
from pyschism.mesh import Hgrid
from pyschism.forcing.bctides import Bctides, iettype, ifltype, isatype, itetype

if __name__ == '__main__':
start_date = datetime(2017, 12, 1)
rnday = 10
outdir = './'

hgrid = Hgrid.open("./hgrid.gr3", crs="epsg:4326")

#elevation
#constituents: major [M2, S2, N2, K2, K1, O1, P1, Q1]
#database: 'tpxo' or 'fes2014'
iet3 = iettype.Iettype3(constituents='major', database='tpxo')
iet4 = iettype.Iettype4()
iet5 = iettype.Iettype5(iettype3=iet3, iettype4=iet4)

#velocity
ifl3 = ifltype.Ifltype3(constituents='major', database='tpxo')
ifl4 = ifltype.Ifltype4()
ifl5 = ifltype.Ifltype5(ifltype3=ifl3, ifltype4=ifl4)

#salinity
isa4 = isatype.Isatype4() #time-varying

#temperature
ite4 = itetype.Itetype4() #time-varying


#example1 - only one ocean boundary and type is [5, 5, 4, 4]
#bctides = Bctides(hgrid, iettype=iet5, ifltype=ifl5, isatype=isa4, itetype=ite4)

#example2 - two ocean open boundaries, one river boundary and type is:
#[5, 5, 4, 4] - first ocean boundary
#[5, 5, 4, 4] - second ocean boudnary
#[0, 0, 3, 3] - river boundary
bctides = Bctides(
hgrid,
iettype = {'1': iet5, '2': iet5},
ifltype = {'1': ifl5, '2': ifl5},
isatype = {'1': isa4, '2':isa4, '3': isa2},
itetype = {'1': ite4, '2':ite4, '3': ite2},
)

bctides.write(outdir,
start_date=start_date,
end_date=rnday,
bctides=True,
overwrite=True,
)
```
30 changes: 2 additions & 28 deletions docs/getting-started/pre-processing-with-pyschism/boundary.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
#**Boundary Condition**
#**Boundary Condition from HYCOM**
Please refer to [this page](https://schism-dev.github.io/schism/master/input-output/bctides.html) for detailed horizontal B.C. and nudging options supported by SCHISM.

##**TPXO**
PySCHISM uses TPXO Global Tidal Model database. You may need to register an account on the website to download the data.

Generating *bctides.in*:
```python
from datetime import datetime
from pyschism.mesh import Hgrid
from pyschism.forcing.bctides import Bctides, iettype, ifltype, isatype, itetype

if __name__ == '__main__':
startdate = datetime(2022, 4, 1)
rnday = 10
hgrid = Hgrid.open("./hgrid.gr3", crs="epsg:4326")
iet3 = iettype.Iettype3(constituents='major', database='tpxo')
iet4 = iettype.Iettype4()
iet5 = iettype.Iettype5(iettype3=iet3, iettype4=iet4)
ifl3 = ifltype.Ifltype3(constituents='major', database='tpxo')
ifl4 = ifltype.Ifltype4()
ifl5 = ifltype.Ifltype5(ifltype3=ifl3, ifltype4=ifl4)
isa3 = isatype.Isatype4()
ite3 = itetype.Itetype4()
bctides = Bctides(hgrid, iettype=iet5, ifltype=ifl5, isatype=isa3, itetype=ite3)
bctides.write('./', startdate, rnday, bctides=True, elev2D=False, uv3D=False, tem3D=False, sal3D=False, overwrite=True)
```

##**HYCOM**
Generating *elev.2D.th.nc*, *SAL_3D.th.nc*, *TEM_3D.th.nc*, and *uv3D.th.nc*:
```python
from datetime import datetime
Expand Down Expand Up @@ -60,4 +34,4 @@ if __name__ == '__main__':
nudge=Nudge()
nudge.fetch_data(outdir, hgrid, vgrid, start_date, rnday)
```
This script also generates nudging coefficient files *SAL_nu.gr3* and *TEM_nu.gr3*.
This script also generates nudging coefficient files *SAL_nu.gr3* and *TEM_nu.gr3*.
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ nav:
- Preprocessing with PySCHISM:
- Overview: getting-started/pre-processing-with-pyschism/overview.md
- Installation: getting-started/pre-processing-with-pyschism/installation.md
- Boundary Conditions: getting-started/pre-processing-with-pyschism/boundary.md
- Tides: getting-started/pre-processing-with-pyschism/bctides.md
- B.C. from HYCOM: getting-started/pre-processing-with-pyschism/boundary.md
- Atmospheric forcing: getting-started/pre-processing-with-pyschism/atmos.md
- Souce and Sink: getting-started/pre-processing-with-pyschism/nwm.md
- Running the model: getting-started/running-model.md
Expand Down

0 comments on commit 871ec1d

Please sign in to comment.