aviso-fes icon indicating copy to clipboard operation
aviso-fes copied to clipboard

Nans in the load tide

Open TPCollings opened this issue 6 months ago • 2 comments

Describe the bug I have downloaded the new FES2022b tidal heights from aviso+ and installed the new pyfes package in a fresh conda environment.

I am testing the data/package using the example code for tide predictions but I only get nan values for the radial/load tide.

I've tried rewriting the yaml file to pass the paths to the handler. The handler is finding the files and reading the data. Is there something obvious I'm missing?

The ocean tide returns a result as expected.

To Reproduce A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., possible to run as-is via python myproblem.py

import pyfes
dataset_dir = "/home/tom/coastal/data/tide_models/fes2022b"
os.environ['DATASET_DIR'] = dataset_dir
handlers = pyfes.load_config(dataset_dir + '/fes_slev_test.yml')
lon = -1.3510 #-7.688
lat = 50.8562 #59.195
date = numpy.datetime64('1983-01-01T00:00:00')
dates = numpy.arange(date, date + numpy.timedelta64(1, 'D'),
                     numpy.timedelta64(1, 'h'))

lons = numpy.full(dates.shape, lon)
lats = numpy.full(dates.shape, lat)

load, load_lp, _out_rad = pyfes.evaluate_tide(handlers['radial'],
                                       dates,
                                       lons,
                                       lats,
                                       num_threads=1)

print("load tide = " + str(load))
load tide = [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
 nan nan nan nan nan nan]

My contents of my yaml file is listed below:

radial:
  cartesian:
    paths:
       2N2: ${DATASET_DIR}/load_tide/2n2_fes2022.nc
       K1: ${DATASET_DIR}/load_tide/k1_fes2022.nc
       K2: ${DATASET_DIR}/load_tide/k2_fes2022.nc
       M2: ${DATASET_DIR}/load_tide/m2_fes2022.nc
       N2: ${DATASET_DIR}/load_tide/n2_fes2022.nc
       O1: ${DATASET_DIR}/load_tide/o1_fes2022.nc
       P1: ${DATASET_DIR}/load_tide/p1_fes2022.nc
       Q1: ${DATASET_DIR}/load_tide/q1_fes2022.nc
       S2: ${DATASET_DIR}/load_tide/s2_fes2022.nc
tide:
  cartesian:
    paths:
      2N2: ${DATASET_DIR}/ocean_tide_extrapolated/2n2_fes2022.nc
      K1: ${DATASET_DIR}/ocean_tide_extrapolated/k1_fes2022.nc
      K2: ${DATASET_DIR}/ocean_tide_extrapolated/k2_fes2022.nc
      M2: ${DATASET_DIR}/ocean_tide_extrapolated/m2_fes2022.nc
      M4: ${DATASET_DIR}/ocean_tide_extrapolated/m4_fes2022.nc
      Mf: ${DATASET_DIR}/ocean_tide_extrapolated/mf_fes2022.nc
      Mm: ${DATASET_DIR}/ocean_tide_extrapolated/mm_fes2022.nc
      Msqm: ${DATASET_DIR}/ocean_tide_extrapolated/msqm_fes2022.nc
      Mtm: ${DATASET_DIR}/ocean_tide_extrapolated/mtm_fes2022.nc
      N2: ${DATASET_DIR}/ocean_tide_extrapolated/n2_fes2022.nc
      O1: ${DATASET_DIR}/ocean_tide_extrapolated/o1_fes2022.nc
      P1: ${DATASET_DIR}/ocean_tide_extrapolated/p1_fes2022.nc
      Q1: ${DATASET_DIR}/ocean_tide_extrapolated/q1_fes2022.nc
      S1: ${DATASET_DIR}/ocean_tide_extrapolated/s1_fes2022.nc
      S2: ${DATASET_DIR}/ocean_tide_extrapolated/s2_fes2022.nc

Expected behavior I would expect non-nan values in the load tide variable.

pyfes/Numpy/Python version information Output from

import sys, numpy, pyfes.version
print(pyfes.__version__)
print(numpy.__version__)
print(sys.version)

2024.6.0 1.26.4 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0]

Additional context On another note, I had to fix the numpy version to <2 when installing otherwise I got an error when loading pyfes. The error occurred when pyfes tried to load the netcdf4 package, and was as follows: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Could this be related?

TPCollings avatar Aug 02 '24 11:08 TPCollings