pyschism icon indicating copy to clipboard operation
pyschism copied to clipboard

Dealing with FES 2014's all junk value

Open maouyami opened this issue 11 months ago • 4 comments

Hello, I'm new to SCHISM and getting the FES 2014 data. This question might be a bit of a beginner's problem but... I was trying the code on the online guide (https://schism-dev.github.io/schism/master/getting-started/pre-processing-with-pyschism/bctides.html), modifying it a bit for FES 2014 values.

import numpy as np

from pyschism.mesh import Hgrid
from pyschism.forcing.bctides import Bctides

if __name__ == '__main__':
    start_date = datetime(2017, 12, 1)
    rnday = 396
    bctypes = [[5, 5, 4, 4]]
    constituents = 'major'
    database = 'fes2014'
    earth_tidal_potential = True
    sthconst = [np.nan, np.nan, 0]
    tobc = [0.5, 0.5, 1]
    sobc = [0.5, 0.5, 1]
    outdir = './'
    hgrid = Hgrid.open("F:/Model/schism/hgrid.gr3", crs="epsg:4326")

    bctides = Bctides(
        hgrid = hgrid,
        flags = bctypes,
        constituents = constituents,
        database = database,
        add_earth_tidal = earth_tidal_potential,
        sthconst = sthconst,
        #tobc = tobc,
        #sobc = sobc,
    )

    bctides.write(
        outdir, 
        start_date=start_date, 
        rnday=rnday, 
        overwrite=True,
    )

Im sure i downloaded all of the FES 2014's data (eastward velocity, northward velocity, ocean tide extrapolated) from their ftp server. However when i run the code, it took an error

runfile('F:/Model/schism/get_bctides.py', wdir='F:/Model/schism')
C:\ProgramData\anaconda3\Lib\site-packages\pyschism\forcing\hycom\gofs.py:8: UserWarning: The seawater library is deprecated! Please use gsw instead.
  import seawater as sw
C:\ProgramData\anaconda3\Lib\site-packages\tqdm\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
Combination of 3 and 4, time history of elevation is read in from elev2D.th.nc!
Combination of 3 and 4, time history of velocity is read in from uv.3D.th.nc!
Traceback (most recent call last):

  File C:\ProgramData\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File f:\model\schism\get_bctides.py:31
    bctides.write(

  File C:\ProgramData\anaconda3\Lib\site-packages\pyschism\forcing\bctides\bctides.py:265 in write
    f.write(str(self))

  File C:\ProgramData\anaconda3\Lib\site-packages\pyschism\forcing\bctides\bctides.py:162 in __str__
    uamp, uphase, vamp, vphase = self.tides.get_velocity(constituent, vertices)

  File C:\ProgramData\anaconda3\Lib\site-packages\pyschism\forcing\bctides\tides.py:160 in get_velocity
    return self.tidal_database.get_velocity(constituent, vertices)

  File C:\ProgramData\anaconda3\Lib\site-packages\pyschism\forcing\bctides\fes2014.py:53 in get_velocity
    uamp = self._get_interpolation(

  File C:\ProgramData\anaconda3\Lib\site-packages\pyschism\forcing\bctides\fes2014.py:135 in _get_interpolation
    raise ValueError('All junk values for {phys_var} {constituent}')

ValueError: All junk values for {phys_var} {constituent}

I assumed it was about FES 2014's velocity files. Any way to deal with this?

maouyami avatar Dec 06 '24 16:12 maouyami