schism-dev / pyschism

Python interface for handling the SCHISM model.
https://schism-dev.github.io/schism/master/getting-started/pre-processing-with-pyschism/overview.html
Apache License 2.0
25 stars 21 forks source link

tpxo compatibility in different grid longitude formats #112

Open BahramKhazaei-NOAA opened 11 months ago

BahramKhazaei-NOAA commented 11 months ago

I realized that when I use longitude values in range (-180,180) pyschism generates different bctides.in compared to a case that I use the same grid but with longitudes translated into range (0, 360). That also results in erroneous simulation results by the model (in a 2D tide-only case).

I'm using tpxo as source. My grid covers Alaska and overlaps with dateline.

Just a note that we had discussions about this before and my recollection is that pyschism internally makes the translation to avoid this, but opened this issue to figure out where this error comes from.

cuill commented 11 months ago

@BahramKhazaei-NOAA I tested with Pacific hgrid. Both ranges generated the same bctides. Would you mind sharing your hgrid?

BahramKhazaei-NOAA commented 11 months ago

I'm comparing these two:

(-180, 180) range --> Not working BS_mesh_v1.14_updatedBC.zip

(0, 360) range --> Working BS_mesh_v1.14_updatedBC_0_360.zip

Thank you for your help.

BahramKhazaei-NOAA commented 11 months ago

And here are the bctides and their difference: bctides.zip

cuill commented 11 months ago

@BahramKhazaei-NOAA It looks like the conversion from [0, 360) to [-180, 180) is wrong.

It should be: lon[lon>180] -= 360