diff --git a/doc/source/user_guide/bilinear_interp.md b/doc/source/user_guide/bilinear_interp.md index 92e7c429..1d7cc161 100644 --- a/doc/source/user_guide/bilinear_interp.md +++ b/doc/source/user_guide/bilinear_interp.md @@ -10,16 +10,16 @@ data = bilinear_interp(ilon,ilat,idata,lon,lat) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/bilinear_interp.py) -#### Inputs +#### Arguments 1. `ilon`: longitude of tidal model 2. `ilat`: latitude of tidal model 3. `idata`: tide model data 4. `lon`: output longitude 5. `lat`: output latitude -#### Options +#### Keyword arguments - `fill_value`: invalid value - `dtype`: output data type -#### Outputs +#### Returns - `data`: interpolated data diff --git a/doc/source/user_guide/calc_astrol_longitudes.md b/doc/source/user_guide/calc_astrol_longitudes.md index 3494bdec..3f10361e 100644 --- a/doc/source/user_guide/calc_astrol_longitudes.md +++ b/doc/source/user_guide/calc_astrol_longitudes.md @@ -12,14 +12,14 @@ s,h,p,N,PP = calc_astrol_longitudes(MJD, ASTRO5=True) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/calc_astrol_longitudes.py) -#### Inputs +#### Arguments 1. `MJD`: Modified Julian Day of input date -#### Options +#### Keyword arguments - `MEEUS`: use additional coefficients from Meeus Astronomical Algorithms - `ASTRO5`: use Meeus Astronomical coefficients as implemented in ASTRO5 -#### Outputs +#### Returns - `s`: mean longitude of moon (degrees) - `h`: mean longitude of sun (degrees) - `p`: mean longitude of lunar perigee (degrees) diff --git a/doc/source/user_guide/calc_delta_time.md b/doc/source/user_guide/calc_delta_time.md index cfeebe50..655141a3 100644 --- a/doc/source/user_guide/calc_delta_time.md +++ b/doc/source/user_guide/calc_delta_time.md @@ -10,11 +10,11 @@ deltat = calc_delta_time(delta_file, idays) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/calc_delta_time.py) -#### Inputs - 1. `delta_file`: - - http://maia.usno.navy.mil/ser7/deltat.data - - ftp://cddis.nasa.gov/products/iers/deltat.data - 2. `idays`: times to interpolate as days since 1992-01-01T00:00:00 +#### Arguments + 1. `delta_file`: + - http://maia.usno.navy.mil/ser7/deltat.data + - ftp://cddis.nasa.gov/products/iers/deltat.data + 2. `idays`: times to interpolate as days since 1992-01-01T00:00:00 -#### Outputs +#### Returns - `deltat`: (TT - UT1) in days diff --git a/doc/source/user_guide/compute_equilibrium_tide.md b/doc/source/user_guide/compute_equilibrium_tide.md index 5edaa0b6..ba19e77c 100644 --- a/doc/source/user_guide/compute_equilibrium_tide.md +++ b/doc/source/user_guide/compute_equilibrium_tide.md @@ -2,7 +2,7 @@ compute_equilibrium_tide.py =========================== - Calculates the long-period equilibrium ocean tides using fifteen spectral lines from Cartwright-Tayler-Edden tables - - Can be used to calculate tidal corrections for imagery + - Can be used to calculate tidal corrections for imagery #### Calling Sequence ```python @@ -11,9 +11,9 @@ lpet = compute_equilibrium_tide(time,lat) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/compute_equilibrium_tide.py) -#### Inputs +#### Arguments 1. `t`: days relative to Jan 1, 1992 (48622mjd) 2. `lat`: latitudes in degrees -#### Outputs +#### Returns - `lpet`: long-period equilibrium tide values diff --git a/doc/source/user_guide/compute_tide_corrections.md b/doc/source/user_guide/compute_tide_corrections.md index 102194a9..0fefeb60 100644 --- a/doc/source/user_guide/compute_tide_corrections.md +++ b/doc/source/user_guide/compute_tide_corrections.md @@ -14,12 +14,12 @@ tide = compute_tide_corrections(x, y, delta_time, DIRECTORY=DIRECTORY, ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/compute_tide_corrections.py) -#### Inputs +#### Arguments 1. `x`: x-coordinates in projection EPSG 2. `y`: y-coordinates in projection EPSG 3. `delta_time`: seconds since EPOCH -#### Options +#### Keyword arguments - `DIRECTORY`: working data directory for tide models - `MODEL`: Tide model to use in correction - `EPOCH`: time period for calculating delta times @@ -40,5 +40,5 @@ tide = compute_tide_corrections(x, y, delta_time, DIRECTORY=DIRECTORY, - `EXTRAPOLATE`: Extrapolate with nearest-neighbors - `FILL_VALUE`: output invalid value -#### Outputs +#### Returns - `tide`: tide height correction reconstructed using the nodal corrections diff --git a/doc/source/user_guide/convert_ll_xy.md b/doc/source/user_guide/convert_ll_xy.md index f1352ff9..244d31dc 100644 --- a/doc/source/user_guide/convert_ll_xy.md +++ b/doc/source/user_guide/convert_ll_xy.md @@ -11,15 +11,15 @@ lon,lat = convert_ll_xy(x,y,PROJ,'B') ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/convert_ll_xy.py) -#### Inputs +#### Arguments 1. `i1`: longitude ('F') or projection easting x ('B') 2. `i2`: latitude ('F') or projection northing y ('B') 3. `PROJ`: spatial reference system code for coordinate transformations 4. `BF`: backwards ('B') or forward ('F') translations -#### Options +#### Keyword arguments - `EPSG`: spatial reference system code for input (F) and output (B) coordinates -#### Outputs +#### Returns - `o1`: projection easting x ('F') or longitude ('B') - `o2`: projection northing y ('F') or latitude ('B') diff --git a/doc/source/user_guide/iers_mean_pole.md b/doc/source/user_guide/iers_mean_pole.md index 0fa72990..4cdecd25 100644 --- a/doc/source/user_guide/iers_mean_pole.md +++ b/doc/source/user_guide/iers_mean_pole.md @@ -12,15 +12,15 @@ x,y,flag = iers_mean_pole(input_file,input_epoch,version,FILL_VALUE=FILL_VALUE) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/iers_mean_pole.py) -#### Inputs +#### Arguments 1. `input_file`: full path to mean-pole.tab file provided by IERS - 2. `input_epoch`: dates for which the angular coordinates of the Conventional Mean Pole are desired in decimal years + 2. `input_epoch`: dates for which the angular coordinates of the Conventional Mean Pole are desired in decimal years 3. `version`: Year of the conventional model (2003, 2010, 2015) -#### Options +#### Keyword arguments - `FILL_VALUE`: value for invalid flags -#### Outputs +#### Returns - `x`: Angular coordinate x of conventional mean pole [arcsec] - `y`: Angular coordinate y of conventional mean pole [arcsec] - `flag`: epoch is valid for version and version number is valid diff --git a/doc/source/user_guide/infer_minor_corrections.md b/doc/source/user_guide/infer_minor_corrections.md index 77750a93..6d45a410 100644 --- a/doc/source/user_guide/infer_minor_corrections.md +++ b/doc/source/user_guide/infer_minor_corrections.md @@ -12,14 +12,14 @@ dh = infer_minor_corrections(t, zmajor, constituents, ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/infer_minor_corrections.py) -#### Inputs +#### Arguments 1. `t`: days relative to Jan 1, 1992 (48622mjd) 2. `zmajor`: Complex oscillations for given constituents/points 3. `constituents`: tidal constituent IDs -#### Options +#### Keyword arguments - `DELTAT`: time correction for converting to Ephemeris Time (days) - `CORRECTIONS`: use nodal corrections from OTIS/ATLAS or GOT models -#### Outputs +#### Returns - `dh`: height from minor constituents diff --git a/doc/source/user_guide/load_constituent.md b/doc/source/user_guide/load_constituent.md index 503c6bdb..dcc17637 100644 --- a/doc/source/user_guide/load_constituent.md +++ b/doc/source/user_guide/load_constituent.md @@ -10,10 +10,10 @@ amplitude,phase,omega,alpha,species = load_constituent(c) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/load_constituent.py) -#### Inputs +#### Arguments 1. `c`: tidal constituent IDs -#### Outputs +#### Returns - `amplitude`: amplitude of equilibrium tide in m for tidal constituent - `phase`: phase of tidal constituent - `omega`: angular frequency of constituent in radians diff --git a/doc/source/user_guide/load_nodal_corrections.md b/doc/source/user_guide/load_nodal_corrections.md index d98df67d..fc112f33 100644 --- a/doc/source/user_guide/load_nodal_corrections.md +++ b/doc/source/user_guide/load_nodal_corrections.md @@ -11,11 +11,11 @@ pu,pf,G = load_nodal_corrections(MJD,constituents) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/load_nodal_corrections.py) -#### Inputs +#### Arguments 1. `MJD`: Modified Julian Day of input date 2. `zmajor`: Complex oscillations for given constituents/points 3. `constituents`: tidal constituent IDs -#### Outputs +#### Returns - `pu`,`pf`: nodal corrections for the constituents - `G`: phase correction in degrees diff --git a/doc/source/user_guide/nearest_extrap.md b/doc/source/user_guide/nearest_extrap.md index 987458f9..2005cf94 100644 --- a/doc/source/user_guide/nearest_extrap.md +++ b/doc/source/user_guide/nearest_extrap.md @@ -10,18 +10,18 @@ data = nearest_extrap(ilon,ilat,idata,lon,lat) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/nearest_extrap.py) -#### Inputs +#### Arguments 1. `ilon`: longitude of tidal model 2. `ilat`: latitude of tidal model 3. `idata`: tide model data 4. `lon`: output longitude 5. `lat`: output latitude -#### Options +#### Keyword arguments - `fill_value`: invalid value - `dtype`: output data type - `cutoff`: return only neighbors within distance in kilometers - `EPSG`: projection of tide model data -#### Outputs +#### Returns - `data`: interpolated data diff --git a/doc/source/user_guide/output_otis_tides.md b/doc/source/user_guide/output_otis_tides.md index a1d54f92..36faa1f8 100644 --- a/doc/source/user_guide/output_otis_tides.md +++ b/doc/source/user_guide/output_otis_tides.md @@ -13,7 +13,7 @@ output_otis_transport(transport_file,u,v,xlim,ylim,constituents) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/output_otis_tides.py) -#### Inputs +#### Arguments - `output_otis_grid()` 1. `grid_file`: output OTIS grid file name 2. `xlim`: x-coordinate grid-cell edges of output grid diff --git a/doc/source/user_guide/predict_tidal_ts.md b/doc/source/user_guide/predict_tidal_ts.md index e0efb108..42c5b764 100644 --- a/doc/source/user_guide/predict_tidal_ts.md +++ b/doc/source/user_guide/predict_tidal_ts.md @@ -2,7 +2,7 @@ predict_tidal_ts.py =================== - Predict tidal time series at a location using harmonic constants - - Can be used to calculate errors as compared to tide gauges or to predict tides at a point + - Can be used to calculate errors as compared to tide gauges or to predict tides at a point #### Calling Sequence ```python @@ -11,14 +11,14 @@ ht = predict_tidal_ts(time,hc,con) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/predict_tidal_ts.py) -#### Inputs +#### Arguments 1. `time`: days relative to Jan 1, 1992 (48622mjd) 2. `hc`: harmonic constant vector (complex) 3. `constituents`: tidal constituent IDs -#### Options +#### Keyword arguments - `DELTAT`: time correction for converting to Ephemeris Time (days) - `CORRECTIONS`: use nodal corrections from OTIS/ATLAS or GOT models -#### Outputs +#### Returns - `ht`: time series reconstructed using the nodal corrections diff --git a/doc/source/user_guide/predict_tide.md b/doc/source/user_guide/predict_tide.md index ca490f98..16b322e4 100644 --- a/doc/source/user_guide/predict_tide.md +++ b/doc/source/user_guide/predict_tide.md @@ -2,7 +2,7 @@ predict_tide.py =============== - Predict tides at a single time using harmonic constants - - Can be used to calculate tidal corrections for imagery + - Can be used to calculate tidal corrections for imagery #### Calling Sequence ```python @@ -11,14 +11,14 @@ ht = predict_tide(time,hc,con) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/predict_tide.py) -#### Inputs +#### Arguments 1. `time`: days relative to Jan 1, 1992 (48622mjd) 2. `hc`: harmonic constant vector (complex) 3. `constituents`: tidal constituent IDs -#### Options +#### Keyword arguments - `DELTAT`: time correction for converting to Ephemeris Time (days) - `CORRECTIONS`: use nodal corrections from OTIS/ATLAS or GOT models -#### Outputs +#### Returns - `ht`: tide values reconstructed using the nodal corrections diff --git a/doc/source/user_guide/predict_tide_drift.md b/doc/source/user_guide/predict_tide_drift.md index fed74e2e..e22dd0eb 100644 --- a/doc/source/user_guide/predict_tide_drift.md +++ b/doc/source/user_guide/predict_tide_drift.md @@ -1,8 +1,8 @@ predict_tide_drift.py =============== - - Predict tides at multiple times and locations using harmonic constants - - Can be used to calculate tidal corrections for airborne and satellite altimetry + - Predict tides at multiple times and locations using harmonic constants + - Can be used to calculate tidal corrections for airborne and satellite altimetry #### Calling Sequence ```python @@ -11,14 +11,14 @@ ht = predict_tide_drift(time,hc,con) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/predict_tide_drift.py) -#### Inputs +#### Arguments 1. `time`: days relative to Jan 1, 1992 (48622mjd) 2. `hc`: harmonic constant vector (complex) 3. `constituents`: tidal constituent IDs -#### Options +#### Keyword arguments - `DELTAT`: time correction for converting to Ephemeris Time (days) - `CORRECTIONS`: use nodal corrections from OTIS/ATLAS or GOT models -#### Outputs +#### Returns - `ht`: time series reconstructed using the nodal corrections diff --git a/doc/source/user_guide/read_FES_model.md b/doc/source/user_guide/read_FES_model.md index 0c5697c0..1f648828 100644 --- a/doc/source/user_guide/read_FES_model.md +++ b/doc/source/user_guide/read_FES_model.md @@ -9,18 +9,17 @@ read_FES_model.py #### Calling Sequence ```python from pyTMD.read_FES_model import read_FES_model -amp,ph = read_FES_model(ilon,ilat,directory,model_files,TYPE='z', +amp,ph = read_FES_model(ilon, ilat, model_files, TYPE='z', VERSION=version,METHOD='spline',GZIP=True,SCALE=1.0/100.0) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/read_FES_model.py) -#### Inputs +#### Arguments 1. `ilon`: longitude to interpolate 2. `ilat`: latitude to interpolate - 3. `directory`: data directory for tide data files - 4. `model_files`: list of model files for each constituent + 3. `model_files`: list of model files for each constituent -#### Options +#### Keyword arguments - `TYPE`: tidal variable to read * `'z'`: heights * `'u'`: horizontal transport velocities @@ -37,6 +36,6 @@ amp,ph = read_FES_model(ilon,ilat,directory,model_files,TYPE='z', - `GZIP`: input files are compressed - `SCALE`: scaling factor for converting to output units -#### Outputs +#### Returns - `amplitude`: amplitudes of tidal constituents - `phase`: phases of tidal constituents diff --git a/doc/source/user_guide/read_GOT_model.md b/doc/source/user_guide/read_GOT_model.md index 5e536f17..36704d32 100644 --- a/doc/source/user_guide/read_GOT_model.md +++ b/doc/source/user_guide/read_GOT_model.md @@ -1,23 +1,22 @@ read_GOT_model.py ================= - - Reads files for Richard Ray's Global Ocean Tide (GOT) models - - Spatially interpolates tidal constituents to input coordinates + - Reads files for Richard Ray's Global Ocean Tide (GOT) models + - Spatially interpolates tidal constituents to input coordinates #### Calling Sequence ```python from pyTMD.read_GOT_model import read_GOT_model -amp,ph = read_GOT_model(ilon,ilat,directory,model_files,METHOD='spline') +amp,ph,c = read_GOT_model(ilon,ilat,model_files,METHOD='spline') ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/read_GOT_model.py) -#### Inputs +#### Arguments 1. `ilon`: longitude to interpolate 2. `ilat`: latitude to interpolate - 3. `directory`: data directory for tide data files - 4. `model_files`: list of model files for each constituent + 3. `model_files`: list of model files for each constituent -#### Options +#### Keyword arguments - `METHOD`: interpolation method * `'bilinear'`: quick bilinear interpolation * `'spline'`: scipy bivariate spline interpolation @@ -25,6 +24,7 @@ amp,ph = read_GOT_model(ilon,ilat,directory,model_files,METHOD='spline') - `GZIP`: input files are compressed - `SCALE`: scaling factor for converting to output units -#### Outputs +#### Returns - `amplitude`: amplitudes of tidal constituents - `phase`: phases of tidal constituents +- `constituents`: list of model constituents diff --git a/doc/source/user_guide/read_iers_EOP.md b/doc/source/user_guide/read_iers_EOP.md index 6383baa6..e98c1f9e 100644 --- a/doc/source/user_guide/read_iers_EOP.md +++ b/doc/source/user_guide/read_iers_EOP.md @@ -1,8 +1,8 @@ read_iers_EOP.py ================ - - Provides the [daily earth orientation parameters (EOP) from IERS](http://www.usno.navy.mil/USNO/earth-orientation/eo-products/weekly) - - Data format: http://maia.usno.navy.mil/ser7/readme.finals + - Provides the [daily earth orientation parameters (EOP) from IERS](http://www.usno.navy.mil/USNO/earth-orientation/eo-products/weekly) + - Data format: http://maia.usno.navy.mil/ser7/readme.finals #### Calling Sequence ```python @@ -11,10 +11,10 @@ MJD,x,y,flag = read_iers_EOP(input_file) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/read_iers_EOP.py) -#### Inputs +#### Arguments 1. `input_file`: full path to IERS EOP "finals" file -#### Outputs +#### Returns - `MJD`: modified Julian date of EOP measurements - `x`: Angular coordinate [arcsec] - `y`: Angular coordinate [arcsec] diff --git a/doc/source/user_guide/read_netcdf_model.md b/doc/source/user_guide/read_netcdf_model.md index 221b6c0d..5d8531ff 100644 --- a/doc/source/user_guide/read_netcdf_model.md +++ b/doc/source/user_guide/read_netcdf_model.md @@ -11,13 +11,13 @@ amp,ph,D,c = read_netcdf_model(ilon,ilat,grid_file,model_files,TYPE='z',METHOD=' ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/read_netcdf_model.py) -#### Inputs +#### Arguments 1. `ilon`: longitude to interpolate 2. `ilat`: latitude to interpolate 3. `grid_file`: grid file for model 4. `model_files`: list of model files for each constituent -#### Options +#### Keyword arguments - `TYPE`: tidal variable to read * `'z'`: heights * `'u'`: horizontal transport velocities @@ -31,7 +31,7 @@ amp,ph,D,c = read_netcdf_model(ilon,ilat,grid_file,model_files,TYPE='z',METHOD=' - `GZIP`: input netCDF4 files are compressed - `SCALE`: scaling factor for converting to output units -#### Outputs +#### Returns - `amplitude`: amplitudes of tidal constituents - `phase`: phases of tidal constituents - `D`: bathymetry of tide model diff --git a/doc/source/user_guide/read_ocean_pole_tide.md b/doc/source/user_guide/read_ocean_pole_tide.md index 7fdb973a..ef128c17 100644 --- a/doc/source/user_guide/read_ocean_pole_tide.md +++ b/doc/source/user_guide/read_ocean_pole_tide.md @@ -14,10 +14,10 @@ ur,un,ue,glon,glat = read_ocean_pole_tide(ocean_pole_tide_file) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/read_ocean_pole_tide.py) -#### Inputs +#### Arguments 1. `input_file`: [IERS 0.5x0.5 map of ocean pole tide coefficients](ftp://maia.usno.navy.mil/conventions/2010/2010_update/chapter7/additional_info/opoleloadcoefcmcor.txt.gz) -#### Outputs +#### Returns - `ur`: radial ocean pole tide coefficients - `un`: north ocean pole tide coefficients - `ue`: east ocean pole tide coefficients diff --git a/doc/source/user_guide/read_tide_model.md b/doc/source/user_guide/read_tide_model.md index a2df8467..a1e50bea 100644 --- a/doc/source/user_guide/read_tide_model.md +++ b/doc/source/user_guide/read_tide_model.md @@ -15,14 +15,14 @@ amp,ph,D,c = read_tide_model(ilon, ilat, grid_file, model_file, EPSG, ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/read_tide_model.py) -#### Inputs +#### Arguments 1. `ilon`: longitude to interpolate 2. `ilat`: latitude to interpolate 3. `grid_file`: grid file for model 4. `model_file`: model file(s) containing constituent data 5. `EPSG`: projection of tide model data -#### Options +#### Keyword arguments - `TYPE`: tidal variable to read * `'z'`: heights * `'u'`: horizontal transport velocities @@ -37,7 +37,7 @@ amp,ph,D,c = read_tide_model(ilon, ilat, grid_file, model_file, EPSG, * `'ATLAS'`: reading a global solution with high-resolution local solutions * `'OTIS'`: combined global solution -#### Outputs +#### Returns - `amplitude`: amplitudes of tidal constituents - `phase`: phases of tidal constituents - `D`: bathymetry of tide model diff --git a/doc/source/user_guide/spatial.rst b/doc/source/user_guide/spatial.rst index 0f326372..761b7076 100644 --- a/doc/source/user_guide/spatial.rst +++ b/doc/source/user_guide/spatial.rst @@ -41,9 +41,9 @@ General Methods Read data from an ascii file - Inputs: full path of input ascii file + Arguments: full path of input ascii file - Options: + Keyword arguments: ``compression`` ascii file is compressed or streamed from memory @@ -58,9 +58,9 @@ General Methods Read data from a netCDF4 file - Inputs: full path of input netCDF4 file + Arguments: full path of input netCDF4 file - Options: + Keyword arguments: ``compression`` netCDF4 file is compressed or streamed from memory @@ -79,9 +79,9 @@ General Methods Read data from a HDF5 file - Inputs: full path of input HDF5 file + Arguments: full path of input HDF5 file - Options: + Keyword arguments: ``compression`` HDF5 file is compressed or streamed from memory @@ -100,9 +100,9 @@ General Methods Read data from a geotiff file - Inputs: full path of input geotiff file + Arguments: full path of input geotiff file - Options: + Keyword arguments: ``compression`` geotiff file is compressed using gzip @@ -113,7 +113,7 @@ General Methods Write data to an ascii file - Inputs: + Arguments: ``output`` python dictionary of output data @@ -121,7 +121,7 @@ General Methods ``filename`` full path of output ascii file - Options: + Keyword arguments: ``delimiter`` for output spatial file @@ -136,7 +136,7 @@ General Methods Write data to a netCDF4 file - Inputs: + Arguments: ``output`` python dictionary of output data @@ -144,7 +144,7 @@ General Methods ``filename`` full path of output netCDF4 file - Options: + Keyword arguments: ``verbose`` print netCDF4 file information @@ -153,7 +153,7 @@ General Methods Write data to a HDF5 file - Inputs: + Arguments: ``output`` python dictionary of output data @@ -161,7 +161,7 @@ General Methods ``filename`` full path of output HDF5 file - Options: + Keyword arguments: ``verbose`` print HDF5 file information @@ -170,7 +170,7 @@ General Methods Write data to a HDF5 file - Inputs: + Arguments: ``output`` python dictionary of output data @@ -178,8 +178,7 @@ General Methods ``filename`` full path of output HDF5 file - - Options: + Keyword arguments: ``verbose`` print geotiff filename @@ -192,7 +191,7 @@ General Methods Add a singleton dimension to a spatial dictionary if non-existent - Options: + Keyword arguments: ``varname``: variable name to modify @@ -201,7 +200,7 @@ General Methods Convert latitudes and heights to a different ellipsoid using Newton-Raphson - Inputs: + Arguments: ``phi1``: latitude of input ellipsoid in degrees @@ -215,14 +214,12 @@ General Methods ``f2``: flattening of output ellipsoid - - Options: + Keyword arguments: ``eps``: tolerance to prevent division by small numbers and to determine convergence ``itmax``: maximum number of iterations to use in Newton-Raphson - Returns: ``phi2``: latitude of output ellipsoid in degrees @@ -234,14 +231,13 @@ General Methods Converts geodetic coordinates to Cartesian coordinates - Inputs: + Arguments: ``lon``: longitude ``lat``: latitude - - Options: + Keyword arguments: ``h``: height @@ -258,7 +254,7 @@ General Methods Convert from Cartesian coordinates to spherical coordinates - Inputs: + Arguments: ``x``, ``y``, ``z`` in Cartesian coordinates @@ -275,11 +271,11 @@ General Methods Convert from Cartesian coordinates to geodetic coordinates using `a closed form solution `_ - Inputs: + Arguments: ``x``, ``y``, ``z`` in Cartesian coordinates - Options: + Keyword arguments: ``a_axis``: semimajor axis of the ellipsoid @@ -298,11 +294,11 @@ General Methods Calculates area scaling factors for a polar stereographic projection - Inputs: + Arguments: ``lat``: latitude - Options: + Keyword arguments: ``flat``: ellipsoidal flattening diff --git a/doc/source/user_guide/tidal_ellipse.md b/doc/source/user_guide/tidal_ellipse.md index 8c176964..c7e77bee 100644 --- a/doc/source/user_guide/tidal_ellipse.md +++ b/doc/source/user_guide/tidal_ellipse.md @@ -10,11 +10,11 @@ umajor,uminor,uincl,uphase = tidal_ellipse(u,v) ``` [Source code](https://github.com/tsutterley/pyTMD/blob/main/pyTMD/tidal_ellipse.py) -#### Inputs +#### Arguments 1. `u`: zonal current (EW) 2. `v`: meridional current (NS) -#### Outputs +#### Returns - `umajor`: amplitude of the semimajor semi-axis - `uminor`: amplitude of the semiminor semi-axis - `uincl`: angle of inclination of the northern semimajor semi-axis diff --git a/doc/source/user_guide/utilities.rst b/doc/source/user_guide/utilities.rst index 70612dd9..9e39da08 100644 --- a/doc/source/user_guide/utilities.rst +++ b/doc/source/user_guide/utilities.rst @@ -35,7 +35,7 @@ General Methods ``local``: BytesIO object or path to file - Keyword Arguments: + Keyword arguments: ``algorithm``: hashing algorithm for checksum validation @@ -43,6 +43,7 @@ General Methods ``'sha1'``: Secure Hash Algorithm + .. method:: pyTMD.utilities.url_split(s) Recursively split a url path into a list diff --git a/notebooks/Check Tide Map.ipynb b/notebooks/Check Tide Map.ipynb index 4639cedc..8f0687c5 100644 --- a/notebooks/Check Tide Map.ipynb +++ b/notebooks/Check Tide Map.ipynb @@ -218,21 +218,18 @@ " model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", "elif (TIDE_MODEL == 'GOT4.8'):\n", " model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", "elif (TIDE_MODEL == 'GOT4.10'):\n", " model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", "elif (TIDE_MODEL == 'FES2014'):\n", @@ -244,9 +241,6 @@ " 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz',\n", " 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz',\n", " 'ssa.nc.gz','t2.nc.gz']\n", - " c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6',\n", - " 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2',\n", - " 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2']\n", " model_format = 'FES'\n", " TYPE = 'z'\n", " SCALE = 1.0/100.0\n", @@ -284,7 +278,7 @@ "elif (model_format == 'GOT'):\n", " # if reading a NASA GOT solution\n", " input_file = os.path.join(model_directory,model_files[0])\n", - " hc,xi,yi = pyTMD.read_GOT_model.read_GOT_grid(input_file, GZIP=True)\n", + " hc,xi,yi,c = pyTMD.read_GOT_model.read_GOT_grid(input_file, GZIP=True)\n", " # invert tidal constituent mask\n", " mz = np.invert(hc.mask)\n", " # adjust longitudinal convention of input latitude and longitude\n", diff --git a/notebooks/Plot Antarctic Tidal Currents.ipynb b/notebooks/Plot Antarctic Tidal Currents.ipynb index 27973256..17bfef63 100644 --- a/notebooks/Plot Antarctic Tidal Currents.ipynb +++ b/notebooks/Plot Antarctic Tidal Currents.ipynb @@ -269,6 +269,9 @@ " 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz',\n", " 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz',\n", " 'ssa.nc.gz','t2.nc.gz']\n", + " model_file = {}\n", + " for key,val in model_directory.items():\n", + " model_file[key] = [os.path.join(val,m) for m in model_files]\n", " c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6',\n", " 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2',\n", " 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2']\n", @@ -344,14 +347,14 @@ " SCALE=SCALE, GZIP=GZIP)\n", " DELTAT = np.zeros_like(tide_time)\n", " elif (model_format == 'GOT'):\n", - " amp,ph = extract_GOT_constants(lon, lat, model_directory, model_files,\n", + " amp,ph,c = extract_GOT_constants(lon, lat, model_file,\n", " METHOD='spline', SCALE=SCALE)\n", " #-- interpolate delta times from calendar dates to tide time\n", " DELTAT = calc_delta_time(delta_file, tide_time)\n", " elif (model_format == 'FES'):\n", - " amp,ph = extract_FES_constants(lon, lat, model_directory[TYPE],\n", - " model_files, TYPE=TYPE, VERSION=MODEL, METHOD='spline',\n", - " SCALE=SCALE, GZIP=GZIP)\n", + " amp,ph = extract_FES_constants(lon, lat, model_file[TYPE],\n", + " TYPE=TYPE, VERSION=MODEL, METHOD='spline', SCALE=SCALE,\n", + " GZIP=GZIP)\n", " #-- interpolate delta times from calendar dates to tide time\n", " DELTAT = calc_delta_time(delta_file, tide_time)\n", " \n", diff --git a/notebooks/Plot Antarctic Tide Range.ipynb b/notebooks/Plot Antarctic Tide Range.ipynb index 91bcf08a..74420a2d 100644 --- a/notebooks/Plot Antarctic Tide Range.ipynb +++ b/notebooks/Plot Antarctic Tide Range.ipynb @@ -223,7 +223,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -231,7 +231,7 @@ " model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -239,7 +239,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -252,6 +252,7 @@ " 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz',\n", " 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz',\n", " 'ssa.nc.gz','t2.nc.gz']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6',\n", " 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2',\n", " 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2']\n", @@ -368,12 +369,11 @@ " amp,ph,D,c = extract_netcdf_constants(lon, lat, grid_file, model_file,\n", " TYPE=TYPE, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", "elif (model_format == 'GOT'):\n", - " amp,ph = extract_GOT_constants(lon, lat, model_directory, model_files,\n", + " amp,ph,c = extract_GOT_constants(lon, lat, model_file,\n", " METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", "elif (model_format == 'FES'):\n", - " amp,ph = extract_FES_constants(lon, lat, model_directory, model_files,\n", - " TYPE=TYPE, VERSION=MODEL, METHOD='spline', SCALE=SCALE,\n", - " GZIP=GZIP)\n", + " amp,ph = extract_FES_constants(lon, lat, model_file, TYPE=TYPE,\n", + " VERSION=MODEL, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " \n", "#-- calculate minor constituent amplitudes\n", "minor_amp = infer_minor_amplitudes(amp,c)\n", diff --git a/notebooks/Plot Arctic Ocean Map.ipynb b/notebooks/Plot Arctic Ocean Map.ipynb index 7a90bdb2..e2fd5506 100644 --- a/notebooks/Plot Arctic Ocean Map.ipynb +++ b/notebooks/Plot Arctic Ocean Map.ipynb @@ -261,7 +261,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/'\n", " 'MiscPubs/19990089548_1999150788.pdf')\n", " model_format = 'GOT'\n", @@ -271,7 +271,7 @@ " model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/'\n", " 'MiscPubs/19990089548_1999150788.pdf')\n", " model_format = 'GOT'\n", @@ -281,7 +281,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/'\n", " 'MiscPubs/19990089548_1999150788.pdf')\n", " model_format = 'GOT'\n", @@ -296,6 +296,7 @@ " 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz',\n", " 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz',\n", " 'ssa.nc.gz','t2.nc.gz']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6',\n", " 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2',\n", " 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2']\n", @@ -368,13 +369,13 @@ " TYPE=TYPE, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " DELTAT = np.zeros_like(tide_time)\n", "elif (model_format == 'GOT'):\n", - " amp,ph = extract_GOT_constants(lon, lat, model_directory, model_files,\n", + " amp,ph,c = extract_GOT_constants(lon, lat, model_file,\n", " METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " #-- interpolate delta times from calendar dates to tide time\n", " DELTAT = calc_delta_time(delta_file, tide_time)\n", "elif (model_format == 'FES'):\n", - " amp,ph = extract_FES_constants(lon, lat, model_directory, model_files,\n", - " TYPE=TYPE, VERSION=MODEL, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", + " amp,ph = extract_FES_constants(lon, lat, model_file, TYPE=TYPE,\n", + " VERSION=MODEL, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " #-- interpolate delta times from calendar dates to tide time\n", " DELTAT = calc_delta_time(delta_file, tide_time)\n", " \n", diff --git a/notebooks/Plot Ross Ice Shelf Map.ipynb b/notebooks/Plot Ross Ice Shelf Map.ipynb index a0124c8a..fa238fc4 100644 --- a/notebooks/Plot Ross Ice Shelf Map.ipynb +++ b/notebooks/Plot Ross Ice Shelf Map.ipynb @@ -243,7 +243,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -251,7 +251,7 @@ " model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -259,7 +259,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -272,6 +272,7 @@ " 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz',\n", " 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz',\n", " 'ssa.nc.gz','t2.nc.gz']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6',\n", " 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2',\n", " 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2']\n", @@ -338,17 +339,17 @@ " EPSG, TYPE=TYPE, METHOD='spline', GRID=model_format)\n", " DELTAT = np.zeros_like(tide_time)\n", "elif (model_format == 'netcdf'):\n", - " amp,ph,D,c = extract_netcdf_constants(lon, lat, grid_file, model_files,\n", + " amp,ph,D,c = extract_netcdf_constants(lon, lat, grid_file, model_file,\n", " TYPE=TYPE, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " DELTAT = np.zeros_like(tide_time)\n", "elif (model_format == 'GOT'):\n", - " amp,ph = extract_GOT_constants(lon, lat, model_directory, model_files,\n", + " amp,ph,c = extract_GOT_constants(lon, lat, model_file,\n", " METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " #-- interpolate delta times from calendar dates to tide time\n", " DELTAT = calc_delta_time(delta_file, tide_time)\n", "elif (model_format == 'FES'):\n", - " amp,ph = extract_FES_constants(lon, lat, model_directory, model_files,\n", - " TYPE=TYPE, VERSION=MODEL, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", + " amp,ph = extract_FES_constants(lon, lat, model_file, TYPE=TYPE,\n", + " VERSION=MODEL, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " #-- interpolate delta times from calendar dates to tide time\n", " DELTAT = calc_delta_time(delta_file, tide_time)\n", " \n", diff --git a/notebooks/Plot Tide Forecasts.ipynb b/notebooks/Plot Tide Forecasts.ipynb index f18ce3f3..8e4bb867 100644 --- a/notebooks/Plot Tide Forecasts.ipynb +++ b/notebooks/Plot Tide Forecasts.ipynb @@ -301,7 +301,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -309,7 +309,7 @@ " model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -317,7 +317,7 @@ " model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide')\n", " model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz',\n", " 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz']\n", - " c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " model_format = 'GOT'\n", " SCALE = 1.0/100.0\n", " GZIP = True\n", @@ -330,6 +330,7 @@ " 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz',\n", " 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz',\n", " 'ssa.nc.gz','t2.nc.gz']\n", + " model_file = [os.path.join(model_directory,m) for m in model_files]\n", " c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6',\n", " 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2',\n", " 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2']\n", @@ -349,15 +350,14 @@ " GZIP=GZIP)\n", " deltat = np.zeros_like(tide_time)\n", "elif (model_format == 'GOT'):\n", - " amp,ph = extract_GOT_constants(np.array([LON]), np.array([LAT]),\n", - " model_directory, model_files, METHOD='spline', SCALE=SCALE,\n", - " GZIP=GZIP)\n", + " amp,ph,c = extract_GOT_constants(np.array([LON]), np.array([LAT]),\n", + " model_file, METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", " #-- interpolate delta times from calendar dates to tide time\n", " deltat = calc_delta_time(delta_file, tide_time)\n", "elif (model_format == 'FES'):\n", " amp,ph = extract_FES_constants(np.array([LON]), np.array([LAT]),\n", - " model_directory, model_files, TYPE=TYPE, VERSION=TIDE_MODEL,\n", - " METHOD='spline', SCALE=SCALE, GZIP=GZIP)\n", + " model_file, TYPE=TYPE, VERSION=TIDE_MODEL, METHOD='spline',\n", + " SCALE=SCALE, GZIP=GZIP)\n", " #-- interpolate delta times from calendar dates to tide time\n", " deltat = calc_delta_time(delta_file, tide_time)\n", " \n", diff --git a/pyTMD/compute_tide_corrections.py b/pyTMD/compute_tide_corrections.py index 98a40ca2..8b7e51fb 100644 --- a/pyTMD/compute_tide_corrections.py +++ b/pyTMD/compute_tide_corrections.py @@ -257,7 +257,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, model_directory = os.path.join(DIRECTORY,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] model_format = 'GOT' SCALE = 1.0/100.0 GZIP = True @@ -266,7 +266,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] model_format = 'GOT' SCALE = 1.0/1000.0 GZIP = True @@ -274,7 +274,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, model_directory = os.path.join(DIRECTORY,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] model_format = 'GOT' SCALE = 1.0/100.0 GZIP = True @@ -283,7 +283,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] model_format = 'GOT' SCALE = 1.0/1000.0 GZIP = True @@ -291,7 +291,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, model_directory = os.path.join(DIRECTORY,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] model_format = 'GOT' SCALE = 1.0/100.0 GZIP = True @@ -300,7 +300,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] model_format = 'GOT' SCALE = 1.0/1000.0 GZIP = True @@ -313,6 +313,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6','m8', 'mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2','n4', 'nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -329,6 +330,7 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -386,14 +388,14 @@ def compute_tide_corrections(x, y, delta_time, DIRECTORY=None, MODEL=None, SCALE=SCALE, GZIP=GZIP) deltat = np.zeros_like(t) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(lon, lat, model_directory, model_files, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(lon, lat, model_file, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, t) elif (model_format == 'FES'): - amp,ph = extract_FES_constants(lon, lat, model_directory, model_files, - TYPE=model_type, VERSION=MODEL, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + amp,ph = extract_FES_constants(lon, lat, model_file, TYPE=model_type, + VERSION=MODEL, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, + SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, t) diff --git a/pyTMD/read_FES_model.py b/pyTMD/read_FES_model.py index 95c4b0b0..78b477f3 100644 --- a/pyTMD/read_FES_model.py +++ b/pyTMD/read_FES_model.py @@ -13,7 +13,6 @@ INPUTS: ilon: longitude to interpolate ilat: latitude to interpolate - directory: data directory for tide data files model_files: list of model files for each constituent (can be gzipped) TYPE: tidal variable to run z: heights @@ -54,6 +53,7 @@ UPDATE HISTORY: Updated 03/2021: add extrapolation check where there are no invalid points prevent ComplexWarning for fill values when calculating amplitudes + simplified inputs to be similar to binary OTIS read program use uuid for reading from gzipped netCDF4 files Updated 02/2021: set invalid values to nan in extrapolation replaced numpy bool to prevent deprecation warning @@ -73,9 +73,8 @@ from pyTMD.nearest_extrap import nearest_extrap #-- PURPOSE: extract tidal harmonic constants from tide models at coordinates -def extract_FES_constants(ilon, ilat, directory, model_files, - TYPE='z', VERSION=None, METHOD='spline', EXTRAPOLATE=False, - GZIP=True, SCALE=1): +def extract_FES_constants(ilon, ilat, model_files, TYPE='z', VERSION=None, + METHOD='spline', EXTRAPOLATE=False, GZIP=True, SCALE=1.0): """ Reads files for an ascii or netCDF4 tidal model Makes initial calculations to run the tide program @@ -85,7 +84,6 @@ def extract_FES_constants(ilon, ilat, directory, model_files, --------- ilon: longitude to interpolate ilat: latitude to interpolate - directory: data directory for tide data files grid_file: grid file for model (can be gzipped) model_files: list of model files for each constituent (can be gzipped) @@ -136,11 +134,13 @@ def extract_FES_constants(ilon, ilat, directory, model_files, for i,fi in enumerate(model_files): #-- read constituent from elevation file if VERSION in ('FES1999','FES2004'): - hc,lon,lat = read_ascii_file(os.path.join(directory,fi), - GZIP=GZIP,TYPE=TYPE,VERSION=VERSION) + #-- FES ascii constituent files + hc,lon,lat = read_ascii_file(os.path.expanduser(fi), + GZIP=GZIP, TYPE=TYPE, VERSION=VERSION) elif VERSION in ('FES2012','FES2014'): - hc,lon,lat = read_netcdf_file(os.path.join(directory,fi), - GZIP=GZIP,TYPE=TYPE,VERSION=VERSION) + #-- FES netCDF4 constituent files + hc,lon,lat = read_netcdf_file(os.path.expanduser(fi), + GZIP=GZIP, TYPE=TYPE, VERSION=VERSION) #-- interpolated complex form of constituent oscillation hci = np.ma.zeros((npts),dtype=hc.dtype,fill_value=hc.fill_value) hci.mask = np.zeros((npts),dtype=bool) diff --git a/pyTMD/read_GOT_model.py b/pyTMD/read_GOT_model.py index 5fcc9823..8dd28c6c 100644 --- a/pyTMD/read_GOT_model.py +++ b/pyTMD/read_GOT_model.py @@ -9,7 +9,6 @@ INPUTS: ilon: longitude to interpolate ilat: latitude to interpolate - directory: data directory for tide data files model_files: list of model files for each constituent OPTIONS: @@ -24,6 +23,7 @@ OUTPUTS: amplitude: amplitudes of tidal constituents phase: phases of tidal constituents + constituents: list of model constituents PYTHON DEPENDENCIES: numpy: Scientific Computing Tools For Python @@ -39,6 +39,7 @@ UPDATE HISTORY: Updated 03/2021: add extrapolation check where there are no invalid points prevent ComplexWarning for fill values when calculating amplitudes + simplified inputs to be similar to binary OTIS read program Updated 02/2021: set invalid values to nan in extrapolation replaced numpy bool to prevent deprecation warning Updated 12/2020: added valid data extrapolation with nearest_extrap @@ -59,6 +60,7 @@ from __future__ import division import os +import re import gzip import numpy as np import scipy.interpolate @@ -66,8 +68,8 @@ from pyTMD.nearest_extrap import nearest_extrap #-- PURPOSE: extract tidal harmonic constants out of GOT model at coordinates -def extract_GOT_constants(ilon, ilat, directory, model_files, - METHOD=None, EXTRAPOLATE=False, GZIP=True, SCALE=1): +def extract_GOT_constants(ilon, ilat, model_files, METHOD=None, + EXTRAPOLATE=False, GZIP=True, SCALE=1.0): """ Reads files for Richard Ray's Global Ocean Tide (GOT) models Makes initial calculations to run the tide program @@ -77,7 +79,6 @@ def extract_GOT_constants(ilon, ilat, directory, model_files, --------- ilon: longitude to interpolate ilat: latitude to interpolate - directory: data directory for tide data files model_files: list of model files for each constituent Keyword arguments @@ -94,6 +95,7 @@ def extract_GOT_constants(ilon, ilat, directory, model_files, ------- amplitude: amplitudes of tidal constituents phase: phases of tidal constituents + constituents: list of model constituents """ #-- adjust dimensions of input coordinates to be iterable @@ -108,6 +110,7 @@ def extract_GOT_constants(ilon, ilat, directory, model_files, #-- number of points npts = len(ilon) #-- amplitude and phase + constituents = [] nc = len(model_files) amplitude = np.ma.zeros((npts,nc)) amplitude.mask = np.zeros((npts,nc),dtype=bool) @@ -116,8 +119,10 @@ def extract_GOT_constants(ilon, ilat, directory, model_files, #-- read and interpolate each constituent for i,model_file in enumerate(model_files): #-- read constituent from elevation file - hc,lon,lat = read_GOT_grid(os.path.join(directory,model_file), + hc,lon,lat,cons = read_GOT_grid(os.path.expanduser(model_file), GZIP=GZIP) + #-- append to the list of constituents + constituents.append(cons) #-- grid step size of tide model dlon = np.abs(lon[1] - lon[0]) dlat = np.abs(lat[1] - lat[0]) @@ -187,7 +192,7 @@ def extract_GOT_constants(ilon, ilat, directory, model_files, amplitude.data[amplitude.mask] = amplitude.fill_value phase.data[phase.mask] = phase.fill_value #-- return the interpolated values - return (amplitude,phase) + return (amplitude,phase,constituents) #-- PURPOSE: wrapper function to extend an array def extend_array(input_array,step_size): @@ -247,15 +252,19 @@ def read_GOT_grid(input_file, GZIP=False): hc: complex form of tidal constituent oscillation lon: longitude of tidal model lat: latitude of tidal model + cons: tidal constituent ID """ #-- read input tide model file if GZIP: with gzip.open(os.path.expanduser(input_file),'rb') as f: - file_contents = f.read().splitlines() + file_contents = f.read().decode('utf-8').splitlines() else: with open(os.path.expanduser(input_file),'r') as f: file_contents = f.read().splitlines() #-- parse header text + constituent_list = ['Q1','O1','P1','K1','N2','M2','S2','K2','S1','M4'] + regex = re.compile(r'|'.join(constituent_list), re.IGNORECASE) + cons = regex.findall(file_contents[0]).pop().lower() nlat,nlon = np.array(file_contents[2].split(), dtype=np.int) #-- longitude range ilat = np.array(file_contents[3].split(), dtype=np.float) @@ -293,4 +302,4 @@ def read_GOT_grid(input_file, GZIP=False): #-- set masks hc.mask = (amp.data == amp.fill_value) | (ph.data == ph.fill_value) #-- return output variables - return (hc,lon,lat) + return (hc,lon,lat,cons) diff --git a/scripts/compute_tidal_currents.py b/scripts/compute_tidal_currents.py index 0f6822dc..cb226b69 100755 --- a/scripts/compute_tidal_currents.py +++ b/scripts/compute_tidal_currents.py @@ -21,8 +21,10 @@ -T X, --tide X: Tide model to use in correction CATS0201 CATS2008 - TPXO9-atlas-v2 TPXO9-atlas + TPXO9-atlas-v2 + TPXO9-atlas-v3 + TPXO9-atlas-v4 TPXO9.1 TPXO8-atlas TPXO7.2 @@ -295,6 +297,9 @@ def compute_tidal_currents(tide_dir, input_file, output_file, 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = {} + for key,val in model_directory.items(): + model_file[key] = [os.path.join(val,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -408,9 +413,8 @@ def compute_tidal_currents(tide_dir, input_file, output_file, deltat = np.zeros((nt)) elif (model_format == 'FES'): amp,ph = extract_FES_constants(lon.flatten(), lat.flatten(), - model_directory[t], model_files, TYPE=t, VERSION=TIDE_MODEL, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=model_scale, - GZIP=GZIP) + model_file[t], TYPE=t, VERSION=TIDE_MODEL, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=model_scale, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) diff --git a/scripts/compute_tidal_elevations.py b/scripts/compute_tidal_elevations.py index d60c9fda..2dcff577 100755 --- a/scripts/compute_tidal_elevations.py +++ b/scripts/compute_tidal_elevations.py @@ -319,7 +319,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_ocean' @@ -332,7 +332,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_load' @@ -344,7 +344,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_ocean' @@ -357,7 +357,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_load' @@ -369,7 +369,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_ocean' @@ -382,7 +382,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_load' @@ -399,6 +399,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -419,6 +420,7 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -521,16 +523,15 @@ def compute_tidal_elevations(tide_dir, input_file, output_file, EXTRAPOLATE=EXTRAPOLATE, SCALE=model_scale, GZIP=GZIP) deltat = np.zeros((nt)) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(lon.flatten(), lat.flatten(), - model_directory, model_files, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=model_scale, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(lon.flatten(), lat.flatten(), + model_file, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, + SCALE=model_scale, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file,tide_time) elif (model_format == 'FES'): amp,ph = extract_FES_constants(lon.flatten(), lat.flatten(), - model_directory, model_files, TYPE=model_type, VERSION=TIDE_MODEL, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=model_scale, - GZIP=GZIP) + model_file, TYPE=model_type, VERSION=TIDE_MODEL, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=model_scale, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file,tide_time) diff --git a/scripts/compute_tides_ICESat2_ATL03.py b/scripts/compute_tides_ICESat2_ATL03.py index d908f1ea..65a7939c 100644 --- a/scripts/compute_tides_ICESat2_ATL03.py +++ b/scripts/compute_tides_ICESat2_ATL03.py @@ -330,6 +330,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -346,6 +347,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -359,6 +361,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -375,6 +378,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -388,6 +392,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -404,6 +409,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -422,6 +428,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -445,6 +452,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -529,15 +537,15 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', SCALE=SCALE, GZIP=GZIP) deltat = np.zeros_like(tide_time) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(lon, lat, model_directory, - model_files, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, - SCALE=SCALE, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(lon, lat, model_file, + METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, + GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) elif (model_format == 'FES'): - amp,ph = extract_FES_constants(lon,lat,model_directory,model_files, - TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + amp,ph = extract_FES_constants(lon, lat, model_file, TYPE=TYPE, + VERSION=TIDE_MODEL, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, + SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) diff --git a/scripts/compute_tides_ICESat2_ATL06.py b/scripts/compute_tides_ICESat2_ATL06.py index 2c9e7624..2c0d9d90 100644 --- a/scripts/compute_tides_ICESat2_ATL06.py +++ b/scripts/compute_tides_ICESat2_ATL06.py @@ -330,6 +330,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -346,6 +347,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -359,6 +361,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -375,6 +378,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -388,6 +392,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -404,6 +409,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -422,6 +428,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -445,6 +452,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -523,15 +531,15 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) deltat = np.zeros_like(tide_time) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(val['longitude'], val['latitude'], - model_directory, model_files, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(val['longitude'], val['latitude'], + model_file, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, + GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) elif (model_format == 'FES'): amp,ph = extract_FES_constants(val['longitude'], val['latitude'], - model_directory, model_files, TYPE=TYPE, VERSION=TIDE_MODEL, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + model_file, TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) diff --git a/scripts/compute_tides_ICESat2_ATL07.py b/scripts/compute_tides_ICESat2_ATL07.py index 22b4e357..71dcfa50 100644 --- a/scripts/compute_tides_ICESat2_ATL07.py +++ b/scripts/compute_tides_ICESat2_ATL07.py @@ -329,7 +329,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'height_segment_ocean' @@ -345,7 +345,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'height_segment_load' @@ -358,7 +358,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'height_segment_ocean' @@ -374,7 +374,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'height_segment_load' @@ -387,7 +387,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'height_segment_ocean' @@ -403,7 +403,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'height_segment_load' @@ -421,6 +421,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -444,6 +445,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -520,15 +522,15 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) deltat = np.zeros_like(tide_time) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(val['longitude'], val['latitude'], - model_directory, model_files, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(val['longitude'], val['latitude'], + model_file, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, + GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) elif (model_format == 'FES'): amp,ph = extract_FES_constants(val['longitude'], val['latitude'], - model_directory, model_files, TYPE=TYPE, VERSION=TIDE_MODEL, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + model_file, TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) diff --git a/scripts/compute_tides_ICESat2_ATL11.py b/scripts/compute_tides_ICESat2_ATL11.py index a3b313b9..9fdcbb9e 100644 --- a/scripts/compute_tides_ICESat2_ATL11.py +++ b/scripts/compute_tides_ICESat2_ATL11.py @@ -314,7 +314,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_ocean' @@ -330,7 +330,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_load' @@ -343,7 +343,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_ocean' @@ -359,7 +359,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_load' @@ -372,7 +372,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_ocean' @@ -388,7 +388,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_load' @@ -406,6 +406,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -429,6 +430,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -546,17 +548,16 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', GZIP=GZIP) deltat = np.zeros_like(tide_time) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(longitude[track], - latitude[track], model_directory, model_files, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, - GZIP=GZIP) + amp,ph,c = extract_GOT_constants(longitude[track], + latitude[track], model_file, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) elif (model_format == 'FES'): amp,ph = extract_FES_constants(longitude[track], - latitude[track], model_directory, model_files, - TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + latitude[track], model_file, TYPE=TYPE, + VERSION=TIDE_MODEL, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, + SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) diff --git a/scripts/compute_tides_ICESat2_ATL12.py b/scripts/compute_tides_ICESat2_ATL12.py index 778188e9..fe06df88 100644 --- a/scripts/compute_tides_ICESat2_ATL12.py +++ b/scripts/compute_tides_ICESat2_ATL12.py @@ -330,7 +330,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_ocean_seg' @@ -346,7 +346,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_load_seg' @@ -359,7 +359,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_ocean_seg' @@ -375,7 +375,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_load_seg' @@ -388,7 +388,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_ocean_seg' @@ -404,7 +404,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') variable = 'tide_load_seg' @@ -422,6 +422,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -445,6 +446,7 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -521,15 +523,15 @@ def compute_tides_ICESat2(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) deltat = np.zeros_like(tide_time) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(val['longitude'], val['latitude'], - model_directory, model_files, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(val['longitude'], val['latitude'], + model_file, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, + GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) elif (model_format == 'FES'): amp,ph = extract_FES_constants(val['longitude'], val['latitude'], - model_directory, model_files, TYPE=TYPE, VERSION=TIDE_MODEL, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + model_file, TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) diff --git a/scripts/compute_tides_ICESat_GLA12.py b/scripts/compute_tides_ICESat_GLA12.py index 032cdda2..e99b796b 100644 --- a/scripts/compute_tides_ICESat_GLA12.py +++ b/scripts/compute_tides_ICESat_GLA12.py @@ -327,6 +327,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -343,6 +344,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -356,6 +358,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -372,6 +375,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -385,6 +389,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -401,6 +406,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') @@ -419,6 +425,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -442,6 +449,7 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -517,14 +525,13 @@ def compute_tides_ICESat(tide_dir, FILE, TIDE_MODEL=None, METHOD='spline', SCALE=SCALE, GZIP=GZIP) deltat = np.zeros_like(tide_time) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(lon_40HZ, lat_40HZ, model_directory, - model_files, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, - SCALE=SCALE, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(lon_40HZ, lat_40HZ, model_file, + METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) elif (model_format == 'FES'): - amp,ph = extract_FES_constants(lon_40HZ, lat_40HZ, model_directory, - model_files, TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, + amp,ph = extract_FES_constants(lon_40HZ, lat_40HZ, model_file, + TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, tide_time) diff --git a/scripts/compute_tides_icebridge_data.py b/scripts/compute_tides_icebridge_data.py index 4fb65151..04d74085 100644 --- a/scripts/compute_tides_icebridge_data.py +++ b/scripts/compute_tides_icebridge_data.py @@ -613,7 +613,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, model_directory = os.path.join(tide_dir,'GOT4.7','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_ocean' @@ -626,7 +626,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_load' @@ -638,7 +638,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, model_directory = os.path.join(tide_dir,'got4.8','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_ocean' @@ -651,7 +651,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_load' @@ -663,7 +663,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, model_directory = os.path.join(tide_dir,'GOT4.10c','grids_oceantide') model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz','m4.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_ocean' @@ -676,7 +676,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, model_files = ['q1load.d.gz','o1load.d.gz','p1load.d.gz','k1load.d.gz', 'n2load.d.gz','m2load.d.gz','s2load.d.gz','k2load.d.gz', 's1load.d.gz','m4load.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1','m4'] + model_file = [os.path.join(model_directory,m) for m in model_files] reference = ('https://denali.gsfc.nasa.gov/personal_pages/ray/' 'MiscPubs/19990089548_1999150788.pdf') output_variable = 'tide_load' @@ -693,6 +693,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -713,6 +714,7 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, 'mu2.nc.gz','n2.nc.gz','n4.nc.gz','nu2.nc.gz','o1.nc.gz','p1.nc.gz', 'q1.nc.gz','r2.nc.gz','s1.nc.gz','s2.nc.gz','s4.nc.gz','sa.nc.gz', 'ssa.nc.gz','t2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','eps2','j1','k1','k2','l2','lambda2','m2','m3','m4','m6', 'm8','mf','mks2','mm','mn4','ms4','msf','msqm','mtm','mu2','n2', 'n4','nu2','o1','p1','q1','r2','s1','s2','s4','sa','ssa','t2'] @@ -806,16 +808,15 @@ def compute_tides_icebridge_data(tide_dir, arg, TIDE_MODEL, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) deltat = np.zeros_like(t) elif (model_format == 'GOT'): - amp,ph = extract_GOT_constants(dinput['lon'], dinput['lat'], - model_directory, model_files, METHOD=METHOD, - EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) + amp,ph,c = extract_GOT_constants(dinput['lon'], dinput['lat'], + model_file, METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, + SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, t) elif (model_format == 'FES'): amp,ph = extract_FES_constants(dinput['lon'], dinput['lat'], - model_directory, model_files, TYPE=TYPE, VERSION=TIDE_MODEL, - METHOD=METHOD, EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, - GZIP=GZIP) + model_file, TYPE=TYPE, VERSION=TIDE_MODEL, METHOD=METHOD, + EXTRAPOLATE=EXTRAPOLATE, SCALE=SCALE, GZIP=GZIP) #-- interpolate delta times from calendar dates to tide time deltat = calc_delta_time(delta_file, t) diff --git a/test/test_fes_predict.py b/test/test_fes_predict.py index e564b2dc..5d8fd2f3 100644 --- a/test/test_fes_predict.py +++ b/test/test_fes_predict.py @@ -82,6 +82,7 @@ def test_verify_FES2014(): model_files = ['2n2.nc.gz','k1.nc.gz','k2.nc.gz','m2.nc.gz','m4.nc.gz', 'mf.nc.gz','mm.nc.gz','msqm.nc.gz','mtm.nc.gz','n2.nc.gz','o1.nc.gz', 'p1.nc.gz','q1.nc.gz','s1.nc.gz','s2.nc.gz'] + model_file = [os.path.join(model_directory,m) for m in model_files] c = ['2n2','k1','k2','m2','m4','mf','mm','msqm','mtm','n2','o1', 'p1','q1','s1','s2'] model_format = 'FES' @@ -108,8 +109,7 @@ def test_verify_FES2014(): #-- extract amplitude and phase from tide model amp,ph = pyTMD.read_FES_model.extract_FES_constants(longitude, latitude, - model_directory, model_files, TYPE=TYPE, VERSION=VERSION, - METHOD='spline', SCALE=SCALE) + model_file, TYPE=TYPE, VERSION=VERSION, METHOD='spline', SCALE=SCALE) #-- interpolate delta times from calendar dates to tide time delta_file = pyTMD.utilities.get_data_path(['data','merged_deltat.data']) deltat = pyTMD.calc_delta_time(delta_file, tide_time) diff --git a/test/test_interpolate.py b/test/test_interpolate.py index 7e8c4256..d47d30b9 100644 --- a/test/test_interpolate.py +++ b/test/test_interpolate.py @@ -103,7 +103,7 @@ def test_interpolate(METHOD, N=324): # calculate functional values at output points FI = np.ma.zeros((ny,nx)) FI.data[:] = franke_3d(X,Y,Z) - FI.mask = np.zeros((ny,nx),dtype=np.bool) + FI.mask = np.zeros((ny,nx),dtype=bool) # use interpolation routines to get values if (METHOD == 'bilinear'): # use quick bilinear to interpolate values @@ -143,7 +143,7 @@ def test_extrapolate(N=324): # calculate functional values at output points FI = np.ma.zeros((ny,nx)) FI.data[:] = franke_3d(X,Y,Z) - FI.mask = np.zeros((ny,nx),dtype=np.bool) + FI.mask = np.zeros((ny,nx),dtype=bool) # use nearest neighbors extrapolation to points test = pyTMD.nearest_extrap(LON,LAT,FI,lon,lat,EPSG='4326') # verify that coordinates are within tolerance @@ -164,7 +164,7 @@ def test_extrapolation_checks(N=324): ny,nx = (len(LAT),len(LON)) # calculate functional values at output points FI = np.ma.zeros((ny,nx)) - FI.mask = np.ones((ny,nx),dtype=np.bool) + FI.mask = np.ones((ny,nx),dtype=bool) # use nearest neighbors extrapolation to points # in case where there are no valid grid points test = pyTMD.nearest_extrap(LON,LAT,FI,lon,lat,EPSG='4326') diff --git a/test/test_perth3_read.py b/test/test_perth3_read.py index 4b97f118..c74e3ee2 100644 --- a/test/test_perth3_read.py +++ b/test/test_perth3_read.py @@ -82,7 +82,8 @@ def test_verify_GOT47(METHOD): #-- perth3 test program infers m4 tidal constituent model_files = ['q1.d.gz','o1.d.gz','p1.d.gz','k1.d.gz','n2.d.gz', 'm2.d.gz','s2.d.gz','k2.d.gz','s1.d.gz'] - c = ['q1','o1','p1','k1','n2','m2','s2','k2','s1'] + model_file = [os.path.join(model_directory,m) for m in model_files] + constituents = ['q1','o1','p1','k1','n2','m2','s2','k2','s1'] model_format = 'GOT' SCALE = 1.0 @@ -109,8 +110,9 @@ def test_verify_GOT47(METHOD): tide_time = MJD - 48622.0 #-- extract amplitude and phase from tide model - amp,ph = pyTMD.read_GOT_model.extract_GOT_constants(longitude, latitude, - model_directory, model_files, METHOD=METHOD, SCALE=SCALE) + amp,ph,cons = pyTMD.read_GOT_model.extract_GOT_constants(longitude, + latitude, model_file, METHOD=METHOD, SCALE=SCALE) + assert all(c in constituents for c in cons) #-- interpolate delta times from calendar dates to tide time delta_file = pyTMD.utilities.get_data_path(['data','merged_deltat.data']) deltat = pyTMD.calc_delta_time(delta_file, tide_time) @@ -124,9 +126,9 @@ def test_verify_GOT47(METHOD): tide.mask = np.zeros((npts),dtype=bool) #-- predict tidal elevations at time and infer minor corrections tide.mask[:] = np.any(hc.mask, axis=1) - tide.data[:] = pyTMD.predict_tide_drift(tide_time, hc, c, + tide.data[:] = pyTMD.predict_tide_drift(tide_time, hc, cons, DELTAT=deltat, CORRECTIONS=model_format) - minor = pyTMD.infer_minor_corrections(tide_time, hc, c, + minor = pyTMD.infer_minor_corrections(tide_time, hc, cons, DELTAT=deltat, CORRECTIONS=model_format) tide.data[:] += minor.data[:]