TPXO to ROMS EXPRESS (tide extraction software)
TPXO to ROMS EXPRESS (tide extraction software)
I have attached my matlab script for extracting the tidal harmonics from the TPXO 7.2 netcdf files and creating a forcing file for ROMS. I've put everything required (I hope) in the zip file. It also does some plots to check the results. My goal, in writing it, was to simplify the process provided in the ROMS repository of software.
If you find a bug please let me know here in this forum so I can fix it.
If you find a bug please let me know here in this forum so I can fix it.
-
- Posts: 56
- Joined: Mon Sep 25, 2006 2:37 pm
- Location: Institue of oceanology ,Chinese acedemy of scinece
Re: TPXO to ROMS EXPRESS (tide extraction software)
I have download the files, but the .zip file can not be unzipped correctly. Can you give me the .m files ?
Re: TPXO to ROMS EXPRESS (tide extraction software)
The problem is with your unzipping software. Here is a link to an evaluation version of WinZip that does work:
http://download.cnet.com/WinZip/3000-22 ... 03164.html
There is plenty of other free compression software. Yes, I tried WinRAR and it failed.
Or you can go to my rather dusty and moth-eaten website www.austides.com where I chose to put the unzipped scripts. While you're there, feel free to ask Professor Loeb a question.
http://download.cnet.com/WinZip/3000-22 ... 03164.html
There is plenty of other free compression software. Yes, I tried WinRAR and it failed.
Or you can go to my rather dusty and moth-eaten website www.austides.com where I chose to put the unzipped scripts. While you're there, feel free to ask Professor Loeb a question.
-
- Posts: 56
- Joined: Mon Sep 25, 2006 2:37 pm
- Location: Institue of oceanology ,Chinese acedemy of scinece
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks. Now, it works.
Re: TPXO to ROMS EXPRESS (tide extraction software)
For information, the romstools package (provided with the agrif version of roms) also has a tidal toolbox (in matlab) that processes TPXO for ROMS. It is called make_tides ...
Re: TPXO to ROMS EXPRESS (tide extraction software)
I'm glad you mentioned this Patrick. I used to use make_tides and am indebted to it's authors - thank you! The main reason I wrote this was (as I recall) at the time, at least, make_tides required the use of a tidal database (provided with ROMS_Tools) derived from TPXO 6.x, rather than directly using the database OSU provides (which by then was TPXO 7.x, which I wanted to use). Also, I have tried to make this script simpler and more straightforward (not sure if I succeeded). Of course, both scripts will work for both the AGRIF and Rutgers versions.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi John, make_tides now reads TPXO7 but we will look at your routines. The management and corrections of tidal phase and amplitude needed in the case of real time forcing is not straightforward. If you simplified some of the treatment processes, that would be interesting to us as well. We may want to converge at some point. cheers ... Patrick
Re: TPXO to ROMS EXPRESS (tide extraction software)
I think I find a bug. Line 74 and line 80 in file "interpTPXO.m" may lead to mistakes when we get more than one i,j value from
"[j,i]=find(dr==(min(min(dr(VARinterp~=0)))));".
I use "VARinterp(ff(n))=VARinterp(j(1),i(1));" to fix it, but I'm not sure whether it is right.(I don't read scripts carefully for my final exam coming....)
====================appendix==========================
err by matlab:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> interpTPXO at 80
VARinterp(ff(n))=VARinterp(j,i);
Error in ==> extractTPXOtides at 120
ur=interpTPXO('URe',ROMSnames(k),TPXOfile_vel,TPXOfile_grid,lonR,latR,maskR
--------------------------
then I found in line 73:
K>> [j,i]
ans =
76 28
76 30
And thank you for you scripts. I think its an easy way to create the tide file for ROMS
"[j,i]=find(dr==(min(min(dr(VARinterp~=0)))));".
I use "VARinterp(ff(n))=VARinterp(j(1),i(1));" to fix it, but I'm not sure whether it is right.(I don't read scripts carefully for my final exam coming....)
====================appendix==========================
err by matlab:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> interpTPXO at 80
VARinterp(ff(n))=VARinterp(j,i);
Error in ==> extractTPXOtides at 120
ur=interpTPXO('URe',ROMSnames(k),TPXOfile_vel,TPXOfile_grid,lonR,latR,maskR
--------------------------
then I found in line 73:
K>> [j,i]
ans =
76 28
76 30
And thank you for you scripts. I think its an easy way to create the tide file for ROMS
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Chilequan,
thanks for your interest. I'm unable to reproduce this error, and to tell the truth, I can't see how it could arise (since min(min.. only seems to return a single value even there are two equal minimums), but your solution appears reasonable. If you like, when your exams are finished, we can discuss this offline (my email address is on the website mentioned above). Good luck with them.
John
thanks for your interest. I'm unable to reproduce this error, and to tell the truth, I can't see how it could arise (since min(min.. only seems to return a single value even there are two equal minimums), but your solution appears reasonable. If you like, when your exams are finished, we can discuss this offline (my email address is on the website mentioned above). Good luck with them.
John
Re: TPXO to ROMS EXPRESS (tide extraction software)
It's true that min(min(....)) can only return a single value. But the codes are
"[j,i]=find(dr==min(min(dr(VARinterp~=0)))));", and
"find(dr=='some value')" may return more than one result.
=================================================
Here is an easy example:
>> a=[1 2;1 4];
[i,j]=find(a==min(min(a)));
[i,j]
ans =
1 1
2 1
"[j,i]=find(dr==min(min(dr(VARinterp~=0)))));", and
"find(dr=='some value')" may return more than one result.
=================================================
Here is an easy example:
>> a=[1 2;1 4];
[i,j]=find(a==min(min(a)));
[i,j]
ans =
1 1
2 1
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi John,
I was testing out your tidal extraction script today, to see how it compares with the scripts I posted on wikiroms (which are fairly cumbersome).
I came across a minor issue that some others might run into.
>> extractTPXOtides
'Extracting ' 'MM' ' amplitudes'
Error using &
Matrix dimensions must agree.
Error in interpTPXO (line 76)
ff=find (mask==1 & VARinterp==0); %ff: wet points that were not assigned 0
Error in extractTPXOtides (line 97)
zr=interpTPXO('hRe',ROMSnames(k),TPXOfile_elev,TPXOfile_grid,lonR,latR,maskR);
It turns the the problem was the range of longitude values. My grid is -180 to 180 and the TPXO7.2 grid is 0 to 360. The interpolation in interpTPXO does not check for this.
I added a lon=mod(lon,360) in interpTPXO.m.
Thanks,
Eli Hunter
Institute for Marine and Coastal Sciences
I was testing out your tidal extraction script today, to see how it compares with the scripts I posted on wikiroms (which are fairly cumbersome).
I came across a minor issue that some others might run into.
>> extractTPXOtides
'Extracting ' 'MM' ' amplitudes'
Error using &
Matrix dimensions must agree.
Error in interpTPXO (line 76)
ff=find (mask==1 & VARinterp==0); %ff: wet points that were not assigned 0
Error in extractTPXOtides (line 97)
zr=interpTPXO('hRe',ROMSnames(k),TPXOfile_elev,TPXOfile_grid,lonR,latR,maskR);
It turns the the problem was the range of longitude values. My grid is -180 to 180 and the TPXO7.2 grid is 0 to 360. The interpolation in interpTPXO does not check for this.
I added a lon=mod(lon,360) in interpTPXO.m.
Thanks,
Eli Hunter
Institute for Marine and Coastal Sciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi there,
So I ran into another issue when running the extraction script. It has to do with writing the output tidal forcing file.
>> extractTPXOtides
'Extracting ' 'K1' ' amplitudes'
'Extracting ' 'K1' ' u components'
'Extracting ' 'K1' ' v components'
'Extracting ' 'M2' ' amplitudes'
'Extracting ' 'M2' ' u components'
'Extracting ' 'M2' ' v components'
Error using snc_get_varput_indexing (line 43)
Expected START to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Instead its type was char.
Error in nc_varput_tmw (line 12)
[start,count,stride] =
snc_get_varput_indexing(ndims,info.Size,size(data),varargin{:});
Error in nc_varput (line 53)
nc_varput_tmw(ncfile,varname,data,varargin{:});
Error in extractTPXOtides (line 213)
nc_varput(ROMS_frc_file,'tide_period',ROMSperiods,'PRESERVE_FVD')
The call to nc_varput has a 'PRESERVE_FVD' input variable, which is not the correct usage in recent SNCTOOLS distributions. This spot is reserved for start,count,stride. PRESERVE_FVD should be set as a preference, i.e. setpref('SNCTOOLS','PRESERVE_FVD',1).
In the extractTPXOtides.m file, there is a comment:
%"PRESERVE_FVD" suppresses the permute that nc_varput_tmw would do.
%start/count/stride has been disabled in nc_varput_tmw.
Is that the case? I think it's generally not good practice to alter a toolbox your software uses.
Eli
So I ran into another issue when running the extraction script. It has to do with writing the output tidal forcing file.
>> extractTPXOtides
'Extracting ' 'K1' ' amplitudes'
'Extracting ' 'K1' ' u components'
'Extracting ' 'K1' ' v components'
'Extracting ' 'M2' ' amplitudes'
'Extracting ' 'M2' ' u components'
'Extracting ' 'M2' ' v components'
Error using snc_get_varput_indexing (line 43)
Expected START to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Instead its type was char.
Error in nc_varput_tmw (line 12)
[start,count,stride] =
snc_get_varput_indexing(ndims,info.Size,size(data),varargin{:});
Error in nc_varput (line 53)
nc_varput_tmw(ncfile,varname,data,varargin{:});
Error in extractTPXOtides (line 213)
nc_varput(ROMS_frc_file,'tide_period',ROMSperiods,'PRESERVE_FVD')
The call to nc_varput has a 'PRESERVE_FVD' input variable, which is not the correct usage in recent SNCTOOLS distributions. This spot is reserved for start,count,stride. PRESERVE_FVD should be set as a preference, i.e. setpref('SNCTOOLS','PRESERVE_FVD',1).
In the extractTPXOtides.m file, there is a comment:
%"PRESERVE_FVD" suppresses the permute that nc_varput_tmw would do.
%start/count/stride has been disabled in nc_varput_tmw.
Is that the case? I think it's generally not good practice to alter a toolbox your software uses.
Eli
Re: TPXO to ROMS EXPRESS (tide extraction software)
Eli,
thanks for pointing these things out. I haven't updated snctools in a long time and clearly it is time to do that.
I think that the Marchesiello/Penven/Gambon team will be revising make_tides soon, and perhaps now also you will be making your tide software extraction software simpler to use. When one or both of those things happens, I think it would be best for people to use one of them, so I will get the forum moderator to remove my stuff from here.
I do hope you guys take up my suggestion for adding the 2D velocities to the forcing file, so that in future they can replace ellipses (for simplicity).
Cheers
John
thanks for pointing these things out. I haven't updated snctools in a long time and clearly it is time to do that.
I think that the Marchesiello/Penven/Gambon team will be revising make_tides soon, and perhaps now also you will be making your tide software extraction software simpler to use. When one or both of those things happens, I think it would be best for people to use one of them, so I will get the forum moderator to remove my stuff from here.
I do hope you guys take up my suggestion for adding the 2D velocities to the forcing file, so that in future they can replace ellipses (for simplicity).
Cheers
John
Re: TPXO to ROMS EXPRESS (tide extraction software)
The tide extraction software (TPXO2ROMS.m) I wrote and posted here last year has been updated. It requires at least R2012a but now uses the native Matlab netcdf interface instead of snctools. It also has improved interpolation (offers a choice between TriscatteredInterp.m and scatteredInterpolant.m/griddedInterpolant.m). Most of the improvements are due to Charles James. It is also faster as it makes use of the fact that both of those schemes are now capable of handling complex numbers.
Actually there is nothing wrong with otps2roms.m which is in the "repository" but I think this is simpler - at least, it does not require unix extract_HC executable.
Added 17 October:
Please see below for new version. This version was saving transports, not velocities.
Actually there is nothing wrong with otps2roms.m which is in the "repository" but I think this is simpler - at least, it does not require unix extract_HC executable.
Added 17 October:
Please see below for new version. This version was saving transports, not velocities.
Last edited by johnluick on Thu Oct 17, 2013 2:58 am, edited 1 time in total.
-
- Posts: 56
- Joined: Mon Sep 25, 2006 2:37 pm
- Location: Institue of oceanology ,Chinese acedemy of scinece
Re: TPXO to ROMS EXPRESS (tide extraction software)
I think that there is something wrong. For example, when i use this code to get tide, the Cmax is often larger than 100.[imgh=][/imgh]
Last edited by yang on Fri Nov 08, 2013 12:31 am, edited 2 times in total.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Please pause Matlab right after the line:
TPXO=readTPXOdata(TPXOfile_elev,TPXOfile_vel,TPXOfile_grid,lonR,latR);
Then enter:
zz=squeeze(TPXO.h.z(:,:,8));
contourf(abs(zz))
colorbar
This will show if the values you are reading in are in correct units etc. What I get are numbers which are typical open ocean M2 amplitudes (0.1 - 0.3). Let me know and I can take it from there.
I should clarify something in my previous email. When I said "there's nothing wrong with otps2roms.m..." what I was trying to say was that in general I think people should use the matlab scripts from the repository (like otps2roms.m) unless they have some specific reason for not doing so. They are more thoroughly tested and keeps everyone on the same page.
One good thing about what Charles did in modifying TPXO2ROMS.m is he substituted in the new way Matlab requires you to interpolate. It is quite a good algorithm and soon TriScatteredInterp will be "deprecated" or whatever they call it.
John
TPXO=readTPXOdata(TPXOfile_elev,TPXOfile_vel,TPXOfile_grid,lonR,latR);
Then enter:
zz=squeeze(TPXO.h.z(:,:,8));
contourf(abs(zz))
colorbar
This will show if the values you are reading in are in correct units etc. What I get are numbers which are typical open ocean M2 amplitudes (0.1 - 0.3). Let me know and I can take it from there.
I should clarify something in my previous email. When I said "there's nothing wrong with otps2roms.m..." what I was trying to say was that in general I think people should use the matlab scripts from the repository (like otps2roms.m) unless they have some specific reason for not doing so. They are more thoroughly tested and keeps everyone on the same page.
One good thing about what Charles did in modifying TPXO2ROMS.m is he substituted in the new way Matlab requires you to interpolate. It is quite a good algorithm and soon TriScatteredInterp will be "deprecated" or whatever they call it.
John
-
- Posts: 56
- Joined: Mon Sep 25, 2006 2:37 pm
- Location: Institue of oceanology ,Chinese acedemy of scinece
Re: TPXO to ROMS EXPRESS (tide extraction software)
OK, the attached map is corresponding to the following code.
TPXO=readTPXOdata(TPXOfile_elev,TPXOfile_vel,TPXOfile_grid,lonR,latR);
zz=squeeze(TPXO.h.z(:,:,8));
contourf(abs(zz))
colorbar
TPXO=readTPXOdata(TPXOfile_elev,TPXOfile_vel,TPXOfile_grid,lonR,latR);
zz=squeeze(TPXO.h.z(:,:,8));
contourf(abs(zz))
colorbar
Last edited by yang on Fri Nov 08, 2013 12:30 am, edited 3 times in total.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Looks good. Before I go further, what version of Matlab are you using? Must be R2012 or later.
-
- Posts: 56
- Joined: Mon Sep 25, 2006 2:37 pm
- Location: Institue of oceanology ,Chinese acedemy of scinece
Re: TPXO to ROMS EXPRESS (tide extraction software)
Last edited by yang on Fri Oct 18, 2013 6:02 am, edited 1 time in total.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Please send your next response to john.luick@austides.com, so we can go offline and thereby not annoy everyone with a troubleshooting exercise. Also, in your email, can you confirm that you are not plotting phase (rather than amplitude) in that first plot you sent?
Re: TPXO to ROMS EXPRESS (tide extraction software)
This version (3.1) should be used. The one I put up a couple of weeks ago saved transports instead of velocities (my apologies). I also made a number of lesser changes which noted are at the start of the function.
23 October note - the new Matlab/netcdf interface commands ncread, nccreate and ncwrite reverse the array order automatically. You need to be really careful. I have replaced the TPXO2ROMS and have uploaded a new TPXO2ROMS.zip which I believe to be CF-compliant, and ROMS did not complain.
As an example, you read in an array which ncdump said was A(eta_rho,xi_rho). Your array in Matlab will look like A(xi_rho,eta_rho). Then for the netcdf output file you define vardims={'xi_rho',L,'eta_rho',M}, which nccreate reverses in the netcdf output file, so that after you write with ncwrite, which reverses the array on output, you finally ncdump the result, and see B(eta_rho,xi_rho)!
Personally, I plan to go back to snctools, to preserve my sanity, but will leave TPXO2ROMS this way so that people won't need snctools to use TPXO2ROMS. The above was tested on R2012a on a Windows PC. I can't test on linux because ours only has R2010.
23 October note - the new Matlab/netcdf interface commands ncread, nccreate and ncwrite reverse the array order automatically. You need to be really careful. I have replaced the TPXO2ROMS and have uploaded a new TPXO2ROMS.zip which I believe to be CF-compliant, and ROMS did not complain.
As an example, you read in an array which ncdump said was A(eta_rho,xi_rho). Your array in Matlab will look like A(xi_rho,eta_rho). Then for the netcdf output file you define vardims={'xi_rho',L,'eta_rho',M}, which nccreate reverses in the netcdf output file, so that after you write with ncwrite, which reverses the array on output, you finally ncdump the result, and see B(eta_rho,xi_rho)!
Personally, I plan to go back to snctools, to preserve my sanity, but will leave TPXO2ROMS this way so that people won't need snctools to use TPXO2ROMS. The above was tested on R2012a on a Windows PC. I can't test on linux because ours only has R2010.
- Attachments
-
- TPXO2ROMS.zip
- (8.01 KiB) Downloaded 2299 times
Re: TPXO to ROMS EXPRESS (tide extraction software)
A week or two ago I posted an update of TPXO2ROMS and some comments about the new Matlab netcdf interface commands ncread, ncwrite, etc.
Since I did so by editing a previous post, there was no notification sent out (as far as I know).
TPXO2ROMS users are advised to download this update.
I would be interested if anyone else has had similar experience with ncread etc.
Since I did so by editing a previous post, there was no notification sent out (as far as I know).
TPXO2ROMS users are advised to download this update.
I would be interested if anyone else has had similar experience with ncread etc.
-
- Posts: 56
- Joined: Mon Sep 25, 2006 2:37 pm
- Location: Institue of oceanology ,Chinese acedemy of scinece
Re: TPXO to ROMS EXPRESS (tide extraction software)
Good work. very nice!
It works well, now.
It works well, now.
-
- Posts: 6
- Joined: Tue Apr 13, 2010 4:16 pm
- Location: South China Sea Institute of Oceanology, CAS
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi,
Is there any way to consider specific tidal u and v components for rotating rectangular grid?
Is there any way to consider specific tidal u and v components for rotating rectangular grid?
Re: TPXO to ROMS EXPRESS (tide extraction software)
Huh? ROMS will want the tidal velocities to be rotated to its grid, according to the "angle" variable.
-
- Posts: 6
- Joined: Tue Apr 13, 2010 4:16 pm
- Location: South China Sea Institute of Oceanology, CAS
Re: TPXO to ROMS EXPRESS (tide extraction software)
Yes, Kate.
So how can I rotate the tidal u and v (for example from TPXO data) to get tidal velocities that are perpendicular to the roms grid? The roms needs tidal current ellipses as the input information for tidal currents. I am confused how to rotate the tidal current ellipses.
So how can I rotate the tidal u and v (for example from TPXO data) to get tidal velocities that are perpendicular to the roms grid? The roms needs tidal current ellipses as the input information for tidal currents. I am confused how to rotate the tidal current ellipses.
- jivica
- Posts: 172
- Joined: Mon May 05, 2003 2:41 pm
- Location: The University of Western Australia, Perth, Australia
- Contact:
Re: TPXO to ROMS EXPRESS (tide extraction software)
I think tidal ellipses, to be more precise inclination, is not rotated to the ROMS grid within forcing file. It is rotated during applying BC see angler(i,j) in the last line of code, in Nonlinear/set_tides.F:
What it important to know is that tidal information (in terms of adding effect to the bry) is needed only along the active boundary cells, NOT AT THE WHOLE grid(!!). But ROMS is reading in a standard way forcing file and needs that info, but you can make trick and fill whole domain with zeros (if you do not know tides or do not want to extract them, ie big grid) and than only replace those along boundaries (+ 1 cell inside if needed for gradients)..... At the same time you can see how to optimize the code not to compute expensive trigonometrical functions etc along ALL POINTS, instead along only BRY stripes....
Cheers,
Ivica
Code: Select all
# if defined UV_TIDES
!
!-----------------------------------------------------------------------
! Add tidal currents (m/s) to 2D momentum climatologies.
!-----------------------------------------------------------------------
!
Utide(:,:)=0.0_r8
Vtide(:,:)=0.0_r8
cff=2.0_r8*pi*(time(ng)-tide_start*day2sec)
DO itide=1,NTC
IF (Tperiod(itide).gt.0.0_r8) THEN
omega=cff/Tperiod(itide)
DO j=MIN(JstrR,Jstr-1),JendR
DO i=MIN(IstrR,Istr-1),IendR
angle=UV_Tangle(i,j,itide)-angler(i,j)
Cheers,
Ivica
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks, Ivica. It's been years since I looked at this. Find a tool once and forget about it.
As for the other question, there are fields for which one might need to rotate to the ROMS grid. The rotation angle is called "angle" in the grid file and it is a matter of applying simple trigonometry. I guess I would assume readers here would have that knowledge already, but there's an example in uv_rotate.F in the ROMS source. Plus of course the code Ivica has pointed out.
As for the other question, there are fields for which one might need to rotate to the ROMS grid. The rotation angle is called "angle" in the grid file and it is a matter of applying simple trigonometry. I guess I would assume readers here would have that knowledge already, but there's an example in uv_rotate.F in the ROMS source. Plus of course the code Ivica has pointed out.
-
- Posts: 6
- Joined: Tue Apr 13, 2010 4:16 pm
- Location: South China Sea Institute of Oceanology, CAS
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks, Ivica and Kate.
Your replay make me clear for preparing tidal forcing file.
Your replay make me clear for preparing tidal forcing file.
Re: TPXO to ROMS EXPRESS (tide extraction software)
http://volkov.oce.orst.edu/tides/tpxo8_atlas.html). You need to download the netcdf files (there are now two per harmonic plus the new grid). Four of the harmonics (MM, MF, MS4, MN4) are at 1/6 degree. I am not sure my interpolation scheme is working properly for them - you can try it for your area and let us all know - it is also possible there are some flaws on the database. I will update the software once this is established.
This new version of TPXO2ROMS (TPXO2ROMSv4pt0) reads from the new TPXO 8 atlas. The most important harmonics in TPXO8 are at 1/30 degree resolution (as opposed to 1/4 degree for version 7.2 and earlier). There are other improvements in TPXO 8 as well (see -
- Posts: 34
- Joined: Tue Oct 28, 2008 3:19 pm
- Location: IT Power
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear all,
I realize this thread is rather old but I noticed this odd line in TPXO2ROMS_v4pt1.m:
line 253: ncwrite(fnOut,'tide_Vphase',vamp)
Should not it be "ncwrite(fnOut,'tide_Vphase',vpha)" rather?
BTW, if some could direct me to a python package permitting similar functionality (i.e. creating tidal forcing file from TPXO dataset) it would be greatly appreciated.
Best,
I realize this thread is rather old but I noticed this odd line in TPXO2ROMS_v4pt1.m:
line 253: ncwrite(fnOut,'tide_Vphase',vamp)
Should not it be "ncwrite(fnOut,'tide_Vphase',vpha)" rather?
BTW, if some could direct me to a python package permitting similar functionality (i.e. creating tidal forcing file from TPXO dataset) it would be greatly appreciated.
Best,
Re: TPXO to ROMS EXPRESS (tide extraction software)
You are quite right of course. Thanks for pointing this out.
I do not know of any python script for this.
John
I do not know of any python script for this.
John
Re: TPXO to ROMS EXPRESS (tide extraction software)
I don't think a python tool equivalent to the John's one exists. I searched for it before because I switched to Python.
There are few python tools on tidal analysis as far as I know. I found the following.
http://sourceforge.net/projects/tappy/
You can possibly write python scripts to create ROMS tidal forcing based on the tool.
I don't have enough energy to do that and the John's tool works fine by me (Thanks, John!).
Or there could be tools to convert Matlab codes to Python? something like f2py (fortran to python) I wonder.
Cheers,
DJ Kobashi
There are few python tools on tidal analysis as far as I know. I found the following.
http://sourceforge.net/projects/tappy/
You can possibly write python scripts to create ROMS tidal forcing based on the tool.
I don't have enough energy to do that and the John's tool works fine by me (Thanks, John!).
Or there could be tools to convert Matlab codes to Python? something like f2py (fortran to python) I wonder.
Cheers,
DJ Kobashi
-
- Posts: 34
- Joined: Tue Oct 28, 2008 3:19 pm
- Location: IT Power
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thank you all,
Here is an early christmas present, a python translation of John's tpxo8_to_roms package.
I've started testing it...so far, so good.
Enjoy
-T-
Here is an early christmas present, a python translation of John's tpxo8_to_roms package.
I've started testing it...so far, so good.
Enjoy
-T-
- Attachments
-
- tpxo8_to_roms_python.zip
- (8.31 KiB) Downloaded 2249 times
Re: TPXO to ROMS EXPRESS (tide extraction software)
I look forward to trying this myself!
Thanks Thomas.
John
Thanks Thomas.
John
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear all,
I am trying TPX02ROMS version 3.2 to generate tides input to my area. However, I have had some issues while using it. These are the errors I am getting:
'Extracting ' 'M2' ' amplitudes'
'Extracting ' 'M2' ' u components'
Error using scatteredInterpolant
The input points must be a double array.
Error in TPXO2ROMS>interpTPXO (line 351)
F=scatteredInterpolant(x(m),y(m),z(m),'nearest');
Error in TPXO2ROMS (line 105)
ei=interpTPXO(TPXO.U,ROMSnames{k},lonR,latR,maskR);
Error in TPXO2ROMS_script (line 20)
TPXO2ROMS(t0,fnIn,fnOut,ndays)[/b]
Since, I have used MATLAB for a couple weeks I do not know how I should proceed to fix these errors. I would appreciate if someone helped me.
Cheers,
I am trying TPX02ROMS version 3.2 to generate tides input to my area. However, I have had some issues while using it. These are the errors I am getting:
'Extracting ' 'M2' ' amplitudes'
'Extracting ' 'M2' ' u components'
Error using scatteredInterpolant
The input points must be a double array.
Error in TPXO2ROMS>interpTPXO (line 351)
F=scatteredInterpolant(x(m),y(m),z(m),'nearest');
Error in TPXO2ROMS (line 105)
ei=interpTPXO(TPXO.U,ROMSnames{k},lonR,latR,maskR);
Error in TPXO2ROMS_script (line 20)
TPXO2ROMS(t0,fnIn,fnOut,ndays)[/b]
Since, I have used MATLAB for a couple weeks I do not know how I should proceed to fix these errors. I would appreciate if someone helped me.
Cheers,
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: TPXO to ROMS EXPRESS (tide extraction software)
I think I did it. Could all confirm whether I changed right or not? I added the following lines:
xx=double(x(:,:));
yy=double(y(:,:));
zz=double(z(:,:));
F=scatteredInterpolant(xx(m),yy(m),zz(m),'nearest');
z=F(xx,yy);
F=griddedInterpolant(xx',yy',zz');
xx=double(x(:,:));
yy=double(y(:,:));
zz=double(z(:,:));
F=scatteredInterpolant(xx(m),yy(m),zz(m),'nearest');
z=F(xx,yy);
F=griddedInterpolant(xx',yy',zz');
- CharlesJames
- Posts: 43
- Joined: Thu May 24, 2007 12:12 pm
- Location: South Australian Research and Development Institute
Re: TPXO to ROMS EXPRESS (tide extraction software)
There may be a couple of issues here, the first is that scatteredInterpolant only takes datatype double (real or complex) so your solution will avoid that error.
But there may still be a problem with your u_tpxo72.nc file - the version of that file that I have has the variables URe and UIm (the variables you are reading at this step) both with datatype "double" so they shouldn't be triggering this problem. I don't know if there are different versions of this file or perhaps someone is saving space by converting the variables to single precision? The latest version of TPXO2ROMS (4.1) uses the TPXO8 netCDF files which might work better for you. In any case if the program runs OK with your fix I'd still have a close look at the resulting forcing file just to make sure it looks the way you expect.
But there may still be a problem with your u_tpxo72.nc file - the version of that file that I have has the variables URe and UIm (the variables you are reading at this step) both with datatype "double" so they shouldn't be triggering this problem. I don't know if there are different versions of this file or perhaps someone is saving space by converting the variables to single precision? The latest version of TPXO2ROMS (4.1) uses the TPXO8 netCDF files which might work better for you. In any case if the program runs OK with your fix I'd still have a close look at the resulting forcing file just to make sure it looks the way you expect.
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: TPXO to ROMS EXPRESS (tide extraction software)
CharlesJames wrote:There may be a couple of issues here, the first is that scatteredInterpolant only takes datatype double (real or complex) so your solution will avoid that error.
But there may still be a problem with your u_tpxo72.nc file - the version of that file that I have has the variables URe and UIm (the variables you are reading at this step) both with datatype "double" so they shouldn't be triggering this problem. I don't know if there are different versions of this file or perhaps someone is saving space by converting the variables to single precision? The latest version of TPXO2ROMS (4.1) uses the TPXO8 netCDF files which might work better for you. In any case if the program runs OK with your fix I'd still have a close look at the resulting forcing file just to make sure it looks the way you expect.
Hmm..., I downloaded tpxo72.nc from this website http://volkov.oce.orst.edu/tides/tpxo8_atlas.html that I took as reference from "tidal forcing topic" at wiki ROMS. About my output when I added those lines worked properly. However, some variables were not right maybe that's why I didn't understand what was wrong. I will try TPXO2ROMS (4.1) out instead.
Let's say I wanted to run TPXO2ROMS_v4pt0.m to my experiment that had a length of 30 years and my reference time I set to start at 1900-01-01. How should I set my t0 and lengthSim in this case?
Thanks in advance
Re: TPXO to ROMS EXPRESS (tide extraction software)
I'm overseas at the moment but I will answer as best I can from memory.
TPXO2ROMS 4.x is designed to run with TPXO 8.1 not TPXO 7.x.. You should download 8.1.
I believe you cannot accurately simulate tides for more than one year with ROMS because it doesn't allow the nodal factors (f and u) to vary over time. Someone correct me if I'm wrong there. The worst offender, O1, will be out by probably 5 to 8 degrees at times, and O1 amplitude out by up to 15 to 20%.
You can do one-year segments and use perfect restarts with new values of t0 and TIDE_START (set them to the same mid-year time). You would also have to change the start time (variable name DATE_START? I forget. It is the one right before TIDE_START in ocean.in).
Or you can forget about using perfect restarts... let's say your tides spin up in 5 days. You can do 370 day simulations starting 5 days before the start of each year then ignore the first five days of simulation. This is what I would do.
But the point is, as far as I know ROMS doesn't allow the harmonics to change in time (over lunar nodal cycle) so you have to use some finagle if you want to really accurately model tides even over one month let alone one year. It would be easy enough to modify the code in ROMS. It should input constants (exactly as from TPXO or other model), not phases at some specific time (as it currently does), and then compute f and u as a function of time, compute the "equation of time", etc... And it definitely should not use the ellipse velocities (which is also does), which are a total waste of computing time and more importantly add unnecessary confusion.
John
TPXO2ROMS 4.x is designed to run with TPXO 8.1 not TPXO 7.x.. You should download 8.1.
I believe you cannot accurately simulate tides for more than one year with ROMS because it doesn't allow the nodal factors (f and u) to vary over time. Someone correct me if I'm wrong there. The worst offender, O1, will be out by probably 5 to 8 degrees at times, and O1 amplitude out by up to 15 to 20%.
You can do one-year segments and use perfect restarts with new values of t0 and TIDE_START (set them to the same mid-year time). You would also have to change the start time (variable name DATE_START? I forget. It is the one right before TIDE_START in ocean.in).
Or you can forget about using perfect restarts... let's say your tides spin up in 5 days. You can do 370 day simulations starting 5 days before the start of each year then ignore the first five days of simulation. This is what I would do.
But the point is, as far as I know ROMS doesn't allow the harmonics to change in time (over lunar nodal cycle) so you have to use some finagle if you want to really accurately model tides even over one month let alone one year. It would be easy enough to modify the code in ROMS. It should input constants (exactly as from TPXO or other model), not phases at some specific time (as it currently does), and then compute f and u as a function of time, compute the "equation of time", etc... And it definitely should not use the ellipse velocities (which is also does), which are a total waste of computing time and more importantly add unnecessary confusion.
John
Re: TPXO to ROMS EXPRESS (tide extraction software)
I have updated the TPXO2ROMS Matlab software for creating a ROMS tidal input file from the TPXO tide database. It is now called TPXO2ROMS_v5pt1. Version 5.1 downloads the latest global tidal inversion (TPXO9) from Oregon State University. You will need permission from the authors (Lana Erofeeva and Gary Egbert) to download the TPXO9 netcdf files.
TPXO2ROMS v5.1 had a lot of changes due to the fact that TPXO9 includes harmonic 2N2. Matlab variables cannot begin with a number (like, 2) and I had previously referred to the different harmonics as struct variables by name, e.g. harmonic.M2, harmonic.K1, etc. Also, the TPXO9 data is organised differently from previous versions (much improved).
This new code worked correctly in extensive checking and testing, but I haven't actually run a ROMS model using the result. If anyone has a problem please let me know asap.
TPXO2ROMS v 5.1 can be freely downloaded from https://austides.com/downloads/
With great thanks to Lana and Gary for their fantastic product and continued updates.
TPXO2ROMS v5.1 had a lot of changes due to the fact that TPXO9 includes harmonic 2N2. Matlab variables cannot begin with a number (like, 2) and I had previously referred to the different harmonics as struct variables by name, e.g. harmonic.M2, harmonic.K1, etc. Also, the TPXO9 data is organised differently from previous versions (much improved).
This new code worked correctly in extensive checking and testing, but I haven't actually run a ROMS model using the result. If anyone has a problem please let me know asap.
TPXO2ROMS v 5.1 can be freely downloaded from https://austides.com/downloads/
With great thanks to Lana and Gary for their fantastic product and continued updates.
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear John luck and all ROMS forum colleagues,
I am extremely grateful to you for providing us with your TPXO v 5.1 zip file that includes scripts named : TPXO2ROMS_v5pt1.m and TPXO2ROMS_v5pt1_script.m . I am new to ROMS and just finished the upwelling test case and Fjord case a couple of days back. I received the OSU TPXO9-atlas-v4 netcdf file from Dr. Lana Erofeeva and Dr. Gary Egbert.
Issue I am facing it is that I have my grid file of the model i want to learn, the tpxo9-atlas-v4 netcdf files and both the matlab scripts TPXO2ROMS_v5pt1.m and TPXO2ROMS_v5pt1_script.m in one single directory added to my MATLAB path. But I am unable to understand which script I should run, in what way I should run (in the sense what command should i give in the command window or I should run the script ) and in what order should I run the command.
Also sir another issue I am facing is in the TPXO2ROMS_v5pt1.m :
In TPXO2ROMS_v5pt1_script.m:
I am a newbie to ROMS and MATLAB and any help from anyone in any manner is extremely appreciated by me.
Looking for a positive reply.
-Neel
I am extremely grateful to you for providing us with your TPXO v 5.1 zip file that includes scripts named : TPXO2ROMS_v5pt1.m and TPXO2ROMS_v5pt1_script.m . I am new to ROMS and just finished the upwelling test case and Fjord case a couple of days back. I received the OSU TPXO9-atlas-v4 netcdf file from Dr. Lana Erofeeva and Dr. Gary Egbert.
Issue I am facing it is that I have my grid file of the model i want to learn, the tpxo9-atlas-v4 netcdf files and both the matlab scripts TPXO2ROMS_v5pt1.m and TPXO2ROMS_v5pt1_script.m in one single directory added to my MATLAB path. But I am unable to understand which script I should run, in what way I should run (in the sense what command should i give in the command window or I should run the script ) and in what order should I run the command.
Also sir another issue I am facing is in the TPXO2ROMS_v5pt1.m :
Should I run the script .m file or in the command window I can type the command = TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,ndays) specifying each parameter in the bracket itself like ndays and fngrid?function TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,ndays)
% t0: start time
% ROMSnames: ROMS components to calculate
% typical components: Q1 O1 P1 K1 N2 M2 S2 K2
% fnGrid: ROMS grid to calculate tidal components on
% fnOut: name of ROMS tide file
% ndays: Approximate length of run in days (default 365)
%Prepares a tidal forcing file for ROMS from TPXO tidal model (OSU) version 9.
%This version requires Matlab R2012a or later because it takes advantage of
%TriScatteredInterp being able to use complex values from R2012a on.
%If run on R2013 on it will use scatteredInterpolant/griddedInterpolant
%instead of TriScatteredInterp which will be discontinued at some point.
%Uses data from: http://volkov.oce.orst.edu/tides/tpxo8_atlas.html
%Download the netcdf files and put them in a folder on your Matlab path.
%Version v5.1
%Many changes needed for reading TPXO9.
%Reads all 15 harmonics from TPXO9 database, only uses those requested in calling script.
%No longer uses struct variables because 2N2 was not an allowed variable name.
In TPXO2ROMS_v5pt1_script.m:
I am unable to understand whether I need to run this script or I can just run the TPXO2ROMS_v5pt1.m script and do I need to mention the path to my directory as is shown the script TPXO2ROMS_v5pt1_script.m% A wrapper for function TPXO2ROMS_v5pt1
%addpath(genpath('/storage0/group/Oceanography/JOHNL/myroms/PrepTides'))
%t0 can be any time of day not necessarily 00:00
%lengthSim is the approximate anticipated length of model run (days) (f & u are computed at mid-point).
%fnGrid is your ROMS grid file.
%TPXO2ROMS will write to fnOut.
%The available choices for ROMSnames are: 'MM' 'MF' 'Q1' 'O1' 'P1' 'K1' 'N2' 'M2' 'S2' 'K2' 'MN4' 'M4' 'MS4' '2N2' 'S1'
%For example, use ROMSnames={'M2' 'S2' 'MM'}; to use M2, S2, and MM only
clear
%****************Modify to suit***************
TIDE_START=17967; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(1968,5,23); %TIDE_START in Matlab datenum
lengthSim=170; %approximate length of model run in days
fnGrid='C:\mystuff\MODELS\myroms\Projects\AGM1\DATA\grd_etopo1_AGM1.nc';
fnOut=['C:\mystuff\MODELS\myroms\Projects\AGM1\DATA\frc_TPXO_AGM1_' datestr(t0,'ddmmmyyyy') '.nc'];
ROMSnames={'MM' 'MF' 'Q1' 'O1' 'P1' 'K1' 'N2' 'M2' 'S2' 'K2' 'MN4' 'M4' 'MS4' '2N2' 'S1'};
%********************************************
Code: Select all
fnGrid='C:\mystuff\MODELS\myroms\Projects\AGM1\DATA\grd_etopo1_AGM1.nc';
fnOut=['C:\mystuff\MODELS\myroms\Projects\AGM1\DATA\frc_TPXO_AGM1_' datestr(t0,'ddmmmyyyy') '.nc'];
ROMSnames={'MM' 'MF' 'Q1' 'O1' 'P1' 'K1' 'N2' 'M2' 'S2' 'K2' 'MN4' 'M4' 'MS4' '2N2' 'S1'};
Looking for a positive reply.
-Neel
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
the script is the Matlab program you should run from the command line or a bash script. There you can change the paths to your ROMS grid file, the output file name and location and the desired constituents as well as information about the time settings for your tides. This script then hands over your input to the function and initiates the processing.
However, if your TPXO files are not in the Matlab folder, you may want to change the path in the function file (TPXO_path). You can also change the names of the files. But I think the function is customized already for the TPXO file names. Just take care about the TPXO version. You are using TPXO-9 atlas. You may have to change the file names accordingly and the atlas data might even have a different file structure. If you are not too familiar with Matlab scripting you should try and find the matching dataset for the Matlab script or vice versa. E.g., I am using TPXO2ROMS version 4.0 with a TPXO8 atlas dataset.
I hope this could help you!
Cate
the script is the Matlab program you should run from the command line or a bash script. There you can change the paths to your ROMS grid file, the output file name and location and the desired constituents as well as information about the time settings for your tides. This script then hands over your input to the function and initiates the processing.
However, if your TPXO files are not in the Matlab folder, you may want to change the path in the function file (TPXO_path). You can also change the names of the files. But I think the function is customized already for the TPXO file names. Just take care about the TPXO version. You are using TPXO-9 atlas. You may have to change the file names accordingly and the atlas data might even have a different file structure. If you are not too familiar with Matlab scripting you should try and find the matching dataset for the Matlab script or vice versa. E.g., I am using TPXO2ROMS version 4.0 with a TPXO8 atlas dataset.
I hope this could help you!
Cate
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks a lot for your help Cate.
I have another issue. While i am running the script TPXO2ROMS_v5pt1_script.m file, I am getting the following error in the command window of MATLAB:
Here is the part I changed in the script(from the default one) as per my location:
1. TPXO2ROMS_v5pt1_script.m
2. TPXO2ROMS_v5pt1.m
No change made in this script
My location for files are as follows-
I realised that I didn't download the grid_tpxo9_atlas_v4.nc file from the TPXO9-atlas-v4 package sent to me. Please let me know if anyone notices any other error. I will download grid_tpxo9_atlas_v4.nc but do I need to download other files as well such as h_s2_tpxo9_atlas_30_v4.nc and corresponding u_s2_tpxo9_atlas_30_v4.nc and all other files (I already have h_q1_tpxo9_atlas_30_v4.nc and u_q1_tpxo9_atlas_30_v4.nc in my directory) ? I want to just compute 'Q1' .All those remaining files are pretty large and I don't want to waste my memory of computer by downloading things I won't compute.
Any help by anyone is highly appreciated.
Thanks in advance.
-Neel
I have another issue. While i am running the script TPXO2ROMS_v5pt1_script.m file, I am getting the following error in the command window of MATLAB:
Let me run you through what I am doing. I gained access to TPXO9-atlas-v4 netcdf version by Dr. Erofeova . I downloaded the h_q1_tpxo9_atlas_30_v4.nc and u_q1_tpxo9_atlas_30_v4.nc , kept them in a single directory along with mexcdf files, matlab_dir, snctools,netcdf_toolbox, my grid file on which I want tidal forcing and both the TPXO2ROMS_v5pt1_script.m and TPXO2ROMS_v5pt1.m and added them to my matlab path.>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Error using internal.matlab.imagesci.nc/openToRead (line 1272)
Could not open grid_tpxo9.nc for reading.
Error in internal.matlab.imagesci.nc (line 121)
this.openToRead();
Error in ncread (line 61)
ncObj = internal.matlab.imagesci.nc(ncFile);
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 412)
X=ncread(TPXOfile.grid,'lon_z');
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR);
Error in TPXO2ROMS_v5pt1_script (line 26)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
>>
Here is the part I changed in the script(from the default one) as per my location:
1. TPXO2ROMS_v5pt1_script.m
Code: Select all
TIDE_START=17967; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(2019,5,23); %TIDE_START in Matlab datenum
lengthSim=170; %approximate length of model run in days
fnGrid='C:\Users\aBc\Documents\MATLAB\TPXO\ROMS_grid_alderneyrace_new.nc';
fnOut=['C:\Users\aBc\Documents\MATLAB\TPXO\frc_TPXO_AGM1_' datestr(t0,'ddmmmyyyy') '.nc'];
ROMSnames={'Q1'};
No change made in this script
My location for files are as follows-
- matlab_dir: C:\Users\aBc\Documents\MATLAB\TPXO
mexcdf: C:\Users\aBc\Documents\MATLAB\TPXO\
netcdf_toolbox: C:\Users\aBc\Documents\MATLAB\TPXO\
h_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO\
u_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO\
grid file on which i want forcing: C:\Users\aBc\Documents\MATLAB\TPXO\
TPXO2ROMS_v5pt1_script.m: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1.m: C:\Users\aBc\Documents\MATLAB\TPXO
I realised that I didn't download the grid_tpxo9_atlas_v4.nc file from the TPXO9-atlas-v4 package sent to me. Please let me know if anyone notices any other error. I will download grid_tpxo9_atlas_v4.nc but do I need to download other files as well such as h_s2_tpxo9_atlas_30_v4.nc and corresponding u_s2_tpxo9_atlas_30_v4.nc and all other files (I already have h_q1_tpxo9_atlas_30_v4.nc and u_q1_tpxo9_atlas_30_v4.nc in my directory) ? I want to just compute 'Q1' .All those remaining files are pretty large and I don't want to waste my memory of computer by downloading things I won't compute.
Any help by anyone is highly appreciated.
Thanks in advance.
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
I just saw this post, and unfortunately may not have time to spend on it for another 24 hours. Will do my best. For now, can only say your script looks fine (one single harmonic should be fine), but the error message is odd - it implies it can find grid_tpxo9.nc, but can't open it! But tearing hair out by the roots over read permissions is more of a linux divertissement than a Windows one, so I'm guessing it is a path issue. Have you done some addpaths in Matlab? I'm also noticing you have a trailing "\" in some but not all of your TPXO paths. I'll get back to this in a day or so, but meanwhile, please let me know if you have sorted it out (and what resolved it).
I just saw this post, and unfortunately may not have time to spend on it for another 24 hours. Will do my best. For now, can only say your script looks fine (one single harmonic should be fine), but the error message is odd - it implies it can find grid_tpxo9.nc, but can't open it! But tearing hair out by the roots over read permissions is more of a linux divertissement than a Windows one, so I'm guessing it is a path issue. Have you done some addpaths in Matlab? I'm also noticing you have a trailing "\" in some but not all of your TPXO paths. I'll get back to this in a day or so, but meanwhile, please let me know if you have sorted it out (and what resolved it).
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello john,
Thank you for the reply. Unfortunately I have added all my path to the files in MATLAB as per requirement.
When I ran the script TPXO2ROMS_v5pt1_script.m, i encountered the following error in my command window of MATLAB:
As far as what you mentioned about a trailing '\' after TPXO was a total error in typing in ROMS forum from my side and I sincerely apologise for that. All files are contained inside the TPXO folder itself with location C:\Users\aBc\Documents\MATLAB\TPXO . This same location has been added to my MATLAB path accordingly with care.
TPXO2ROMS_v5pt1_script.m :
In TPXO2ROMS_v5pt1.m , i changed the file names as per the name of the TPXO file I downloaded from TPXO9_atlas_nc packing sent to me by Dr. Erofeeva which were h_q1_tpxo9_atlas_30_v4.nc and u_q1_tpxo9_atlas_30_v4.nc and grid_tpxo9_atlas_v4.nc :
These are the new errors that I encountered today as a result of downloading grid_tpxo9_atlas_v4.nc file which I previously didn't have yesterday.
Any help in any kind is appreciated. I know I am bugging you guys unnecessarily but I am not able to navigate these problems as I am very new to Linux WSL in Windows, ROMS and MATLAB.
Thanks in advance for sparing a portion of your valuable time to help me out.
-Neel
Thank you for the reply. Unfortunately I have added all my path to the files in MATLAB as per requirement.
When I ran the script TPXO2ROMS_v5pt1_script.m, i encountered the following error in my command window of MATLAB:
I don't know what went wrong in line 421 of TPXO2ROMS_v5pt1_script.m . Is it a problem with my grid file which I created using Austides GridBuilder .exe version 0.99.5 August 2016 ? I am not able to figure that out as the grid looked pretty good to me while making it. I shall attach that grid file for your reference.Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\4dvar
> In path (line 109)
In startup (line 27)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\bathymetry
> In path (line 109)
In startup (line 28)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\boundary
> In path (line 109)
In startup (line 29)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\coastlines
> In path (line 109)
In startup (line 30)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\colormaps
> In path (line 109)
In startup (line 31)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\forcing
> In path (line 109)
In startup (line 32)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\grid
> In path (line 109)
In startup (line 33)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\grid_gui
> In path (line 109)
In startup (line 34)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\initial
> In path (line 109)
In startup (line 35)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\landmask
> In path (line 109)
In startup (line 36)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\mex
> In path (line 109)
In startup (line 37)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\netcdf
> In path (line 109)
In startup (line 38)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\seagrid
> In path (line 109)
In startup (line 39)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\seagrid\presto
> In path (line 109)
In startup (line 40)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\seawater
> In path (line 109)
In startup (line 41)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\t_tide
> In path (line 109)
In startup (line 42)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\tidal_ellipse
> In path (line 109)
In startup (line 43)
Warning: Name is nonexistent or not a directory: C:\ocean\repository\matlab\utility
> In path (line 109)
In startup (line 44)
>> TPXO2ROMS_v5pt1
Not enough input arguments.
Error in TPXO2ROMS_v5pt1 (line 61)
ROMStitle=['ROMS TPXO data for ' datestr(t0,0)];
>> clear all
>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Index exceeds the number of array elements (0).
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 421)
TPXO.h.depth=ncread(TPXOfile.grid,'hz',[h.I(1) h.J(1)],[length(h.I) length(h.J)]); %bathymetry at z nodes
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR);
Error in TPXO2ROMS_v5pt1_script (line 26)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
>>
As far as what you mentioned about a trailing '\' after TPXO was a total error in typing in ROMS forum from my side and I sincerely apologise for that. All files are contained inside the TPXO folder itself with location C:\Users\aBc\Documents\MATLAB\TPXO . This same location has been added to my MATLAB path accordingly with care.
- My location for files are as follows-
matlab_dir: C:\Users\aBc\Documents\MATLAB\TPXO
mexcdf: C:\Users\aBc\Documents\MATLAB\TPXO
netcdf_toolbox: C:\Users\aBc\Documents\MATLAB\TPXO
h_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
u_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
grid file on which i want forcing: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1_script.m: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1.m: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1_script.m :
Code: Select all
TIDE_START=17967; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(2019,5,23); %TIDE_START in Matlab datenum
lengthSim=30; %approximate length of model run in days
fnGrid='C:\Users\aBc\Documents\MATLAB\TPXO\ROMS_grid_alderneyrace_new.nc';
fnOut=['C:\Users\aBc\Documents\MATLAB\TPXO\frc_TPXO_AGM1_' datestr(t0,'ddmmmyyyy') '.nc'];
ROMSnames={'Q1'};
Code: Select all
%TPXO filenames (files must be on Matlab path)
TPXOfile.grid='grid_tpxo9_atlas_v4.nc';
TPXOfile.elev='h_q1_tpxo9_atlas_30_v4.nc';
TPXOfile.vel='u_q1_tpxo9_atlas_30_v4.nc';
Any help in any kind is appreciated. I know I am bugging you guys unnecessarily but I am not able to navigate these problems as I am very new to Linux WSL in Windows, ROMS and MATLAB.
Thanks in advance for sparing a portion of your valuable time to help me out.
-Neel
- Attachments
-
- ROMS_grid_alderneyrace_new.nc
- This is the grid file on which I will do tidal forcing.
- (6.85 MiB) Downloaded 1895 times
-
TPXO2ROMS_v5pt1.m
- (22.76 KiB) Downloaded 1895 times
-
TPXO2ROMS_v5pt1_script.m
- (1.29 KiB) Downloaded 1896 times
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
I really want to help you so I took another look at your function file. I know that John Luick is the absolute expert here but maybe this could help:
Before the critical line (line 421 is the line where the depth is read from the TPXO grid file) the variables X and Y are determined on the basis of lon_z and lat_z. These are one-dimensional variables in the TPXO files. I think the line 415 doesn't work like that so the indices for the reading are odd. Try this instead of lines 412 and 413 maybe:
But, as I said, I am no expert with this, so this may just be a sloppy workaround. ![Wink ;)](./images/smilies/icon_wink.gif)
I really want to help you so I took another look at your function file. I know that John Luick is the absolute expert here but maybe this could help:
Before the critical line (line 421 is the line where the depth is read from the TPXO grid file) the variables X and Y are determined on the basis of lon_z and lat_z. These are one-dimensional variables in the TPXO files. I think the line 415 doesn't work like that so the indices for the reading are odd. Try this instead of lines 412 and 413 maybe:
Code: Select all
Xi=ncread(TPXOfile.grid,'lon_z');
Yi=ncread(TPXOfile.grid,'lat_z');
[X,Y]=meshgrid(Xi,Yi);
![Wink ;)](./images/smilies/icon_wink.gif)
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hey Cate
Thanka a lot for your help. But I'm sorry to inform you that now I am getting a diffrent error by making the changes in TPXO2ROMS_v5pt1.m you suggested:
I am attaching my script files and grid file for your reference. MY TPXO9_atlas_30_v4 files are all same as in previous posts .nc files by me.
Thanks a lot in advance.
-Neel
Thanka a lot for your help. But I'm sorry to inform you that now I am getting a diffrent error by making the changes in TPXO2ROMS_v5pt1.m you suggested:
The error message I received is as follows while running TPXO2ROMS_v5pt1_script.m is :Before the critical line (line 421 is the line where the depth is read from the TPXO grid file) the variables X and Y are determined on the basis of lon_z and lat_z. These are one-dimensional variables in the TPXO files. I think the line 415 doesn't work like that so the indices for the reading are odd. Try this instead of lines 412 and 413 maybe:
CODE: SELECT ALL
Xi=ncread(TPXOfile.grid,'lon_z');
Yi=ncread(TPXOfile.grid,'lat_z');
[X,Y]=meshgrid(Xi,Yi);
But, as I said, I am no expert with this, so this may just be a sloppy workaround.![]()
My critical line 432 in TPXO2ROMS_v5pt1.m looks like this :>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Index exceeds the number of array elements (0).
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 432)
TPXO.U.depth=ncread(TPXOfile.grid,'hu',[u.I(1) u.J(1)],[length(u.I) length(u.J)]); %bathymetry at z nodes
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR);
Error in TPXO2ROMS_v5pt1_script (line 26)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
Code: Select all
TPXO.U.depth=ncread(TPXOfile.grid,'hu',[u.I(1) u.J(1)],[length(u.I) length(u.J)]); %bathymetry at z nodes
- My location for files are as follows-
matlab_dir: C:\Users\aBc\Documents\MATLAB\TPXO
mexcdf: C:\Users\aBc\Documents\MATLAB\TPXO
netcdf_toolbox: C:\Users\aBc\Documents\MATLAB\TPXO
h_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
u_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
grid file on which i want forcing: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1_script.m: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1.m: C:\Users\aBc\Documents\MATLAB\TPXO
Thanks a lot in advance.
-Neel
- Attachments
-
- ROMS_grid_alderneyrace_new.nc
- This is the file on which I want to do tidal forcing.
- (6.85 MiB) Downloaded 2405 times
-
TPXO2ROMS_v5pt1.m
- (22.79 KiB) Downloaded 2311 times
-
TPXO2ROMS_v5pt1_script.m
- (1.29 KiB) Downloaded 1847 times
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
yes, it's basically the same problem as above, just now for the u-coordinate latitudes and longitudes and will be the same for the v-coordinate lat/lon, too. So I suggest you add the meshgrid lines there, too:
instead of lines 423 and 424
as well as
instead of 433 and 434.
Let me know if this solved your problem.![Smile :)](./images/smilies/icon_smile.gif)
yes, it's basically the same problem as above, just now for the u-coordinate latitudes and longitudes and will be the same for the v-coordinate lat/lon, too. So I suggest you add the meshgrid lines there, too:
Code: Select all
Xi=ncread(TPXOfile.grid,'lon_u');
Yi=ncread(TPXOfile.grid,'lat_u');
[X,Y]=meshgrid((Xi,Yi);
as well as
Code: Select all
Xi=ncread(TPXOfile.grid,'lon_v');
Yi=ncread(TPXOfile.grid,'lat_v');
[X,Y]=meshgrid((Xi,Yi);
Let me know if this solved your problem.
![Smile :)](./images/smilies/icon_smile.gif)
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
I hope Cate's solution worked for you. I downloaded your grid, and it also caused an error for me. I don't have time tonight to work out what's the problem with the grid. Maybe it will help you to get the software running with a grid that doesn't create an error, so I will attach a working one.
Cheers
John
ps here are the lines from my TPXO v5pt2 script file.
%****************Vizhinjam***************
RUNTPXO=1; %set to 0 to skip computation - handy for playing with the plot only
TIDE_START=18485; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(1968,5,23); %TIDE_START in Matlab datenum
lengthSim=60; %approximate length of model run in days
fnGrid='C:\_mystuff\MODELS\myroms\Projects\Vizhinjam\DATA\grd_Vizhinjam.nc';
fnOut=['C:\_mystuff\MODELS\myroms\Projects\Vizhinjam\DATA\frc_TPXO9_Vizhinjam_' datestr(t0,'ddmmmyyyy') '_v4.nc'];
ROMSnames={'M2' 'S2' 'N2' 'K2' 'K1' 'O1' 'P1' 'Q1'};
%Hplot, skip, sfac, and smaj are parameters for the ellipse map
Hplot='M2'; %Which harmonic to plot (name one, e.g. 'M2', 'K1', etc.)
skip=10; %plot each skipth'th ellipse
sfac=0.1; %sf=scalefactor (the ellipse sizes are arbitrary)
smaj=1; %Semi-major axis of scale factor ellipse
%********************************************
I hope Cate's solution worked for you. I downloaded your grid, and it also caused an error for me. I don't have time tonight to work out what's the problem with the grid. Maybe it will help you to get the software running with a grid that doesn't create an error, so I will attach a working one.
Cheers
John
ps here are the lines from my TPXO v5pt2 script file.
%****************Vizhinjam***************
RUNTPXO=1; %set to 0 to skip computation - handy for playing with the plot only
TIDE_START=18485; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(1968,5,23); %TIDE_START in Matlab datenum
lengthSim=60; %approximate length of model run in days
fnGrid='C:\_mystuff\MODELS\myroms\Projects\Vizhinjam\DATA\grd_Vizhinjam.nc';
fnOut=['C:\_mystuff\MODELS\myroms\Projects\Vizhinjam\DATA\frc_TPXO9_Vizhinjam_' datestr(t0,'ddmmmyyyy') '_v4.nc'];
ROMSnames={'M2' 'S2' 'N2' 'K2' 'K1' 'O1' 'P1' 'Q1'};
%Hplot, skip, sfac, and smaj are parameters for the ellipse map
Hplot='M2'; %Which harmonic to plot (name one, e.g. 'M2', 'K1', etc.)
skip=10; %plot each skipth'th ellipse
sfac=0.1; %sf=scalefactor (the ellipse sizes are arbitrary)
smaj=1; %Semi-major axis of scale factor ellipse
%********************************************
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks a lot Cate and John for your help.
Maybe there is an issue with my grid file, I will check that.
I made the changes suggested by Cate for my grid but sadly it didn't work out (I shall post the error at the end):
Any help from anyone is extremely appreciated.
I am attaching my grid file in .mat format and .nc format both which I generated through GridBuilder tool as generously posted on Austides website
thanks a lot in advance.
-Neel
Maybe there is an issue with my grid file, I will check that.
I made the changes suggested by Cate for my grid but sadly it didn't work out (I shall post the error at the end):
I also downloaded Mr. John's grid file grd_Vizhinjam.nc that he suggested and applied it to the updated script by Cate's help:Hi Neel,
yes, it's basically the same problem as above, just now for the u-coordinate latitudes and longitudes and will be the same for the v-coordinate lat/lon, too. So I suggest you add the meshgrid lines there, too:
CODE: SELECT ALL
Xi=ncread(TPXOfile.grid,'lon_u');
Yi=ncread(TPXOfile.grid,'lat_u');
[X,Y]=meshgrid((Xi,Yi);
instead of lines 423 and 424
as well as
CODE: SELECT ALL
Xi=ncread(TPXOfile.grid,'lon_v');
Yi=ncread(TPXOfile.grid,'lat_v');
[X,Y]=meshgrid((Xi,Yi);
instead of 433 and 434.
Let me know if this solved your problem.![]()
In both the cases I ran into the same error as follows, both in my grid file and also Mr. John's grid file:Hi Neel,
I hope Cate's solution worked for you. I downloaded your grid, and it also caused an error for me. I don't have time tonight to work out what's the problem with the grid. Maybe it will help you to get the software running with a grid that doesn't create an error, so I will attach a working one.
Cheers
John
ps here are the lines from my TPXO v5pt2 script file.
%****************Vizhinjam***************
RUNTPXO=1; %set to 0 to skip computation - handy for playing with the plot only
TIDE_START=18485; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(1968,5,23); %TIDE_START in Matlab datenum
lengthSim=60; %approximate length of model run in days
fnGrid='C:\_mystuff\MODELS\myroms\Projects\Vizhinjam\DATA\grd_Vizhinjam.nc';
fnOut=['C:\_mystuff\MODELS\myroms\Projects\Vizhinjam\DATA\frc_TPXO9_Vizhinjam_' datestr(t0,'ddmmmyyyy') '_v4.nc'];
ROMSnames={'M2' 'S2' 'N2' 'K2' 'K1' 'O1' 'P1' 'Q1'};
%Hplot, skip, sfac, and smaj are parameters for the ellipse map
Hplot='M2'; %Which harmonic to plot (name one, e.g. 'M2', 'K1', etc.)
skip=10; %plot each skipth'th ellipse
sfac=0.1; %sf=scalefactor (the ellipse sizes are arbitrary)
smaj=1; %Semi-major axis of scale factor ellipse
%********************************************
grd_Vizhinjam.nc
I don't know why START is taking 3 elements and how to remove that error. I am not even sure if it's an issue with my alderney_rice grid file or just the tPXO9_atlas_30_v4 files of which I only downloaded h_q1_tpxo9_atlas_30_v4.nc,u_q1_tpxo9_atlas_30_v4.nc and grid_tpxo9_atlas_v4.nc or just the script in general. All my file names and locations are same as previous posts.>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Error using internal.matlab.imagesci.nc/read (line 613)
START has incorrect number of elements (3). The variable has 2 dimensions.
Error in ncread (line 66)
vardata = ncObj.read(varName, varargin{:});
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 453)
Z=complex(ncread(TPXOfile.elev,'hRe',[h.I(1) h.J(1) nH],[length(h.I) length(h.J) 1]),...
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR);
Error in TPXO2ROMS_v5pt1_script (line 32)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
Any help from anyone is extremely appreciated.
I am attaching my grid file in .mat format and .nc format both which I generated through GridBuilder tool as generously posted on Austides website
thanks a lot in advance.
-Neel
- Attachments
-
TPXO2ROMS_v5pt1_script.m
- (1.61 KiB) Downloaded 1881 times
-
TPXO2ROMS_v5pt1.m
- (22.84 KiB) Downloaded 1908 times
-
- Alderney_race_grid_mat_format.zip
- My alderney rice grid file generated by GridBuilder by me saved in .mat format
- (1.87 MiB) Downloaded 1841 times
-
- ROMS_grid_alderneyrace_new.nc
- My alderney rice grid file generated by GridBuilder by me
- (6.85 MiB) Downloaded 1892 times
-
- grd_Vizhinjam.nc
- Grid file sent to me by Mr. John for testing
- (7.67 MiB) Downloaded 1896 times
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
I think I know what the issue is. The dimension ncread complains about is nH which is the number of constituents. You are only using one of them, Q1 as I can see. In your file the variables such as h have only two dimensions. I think in TPXO files with more than one constituent they have another dimension which is equivalent to nH. I ran into the same issue when I just wanted to simulate M2. What I did was to insert an if-condition for nH being one and then removing nH as a dimension in the reading lines. However, this would be a larger overhaul of the code and one could easily get confused and mess up the beautiful work of John Luick.
I suggest that you either wait for John Luick's solution or save the function file as a backup before you try and make the following changes:
in lines 451 to 453
in lines 456 to 459
in lines 462 to 465.
BUT, I really have to admit that I am not sure if I had to change more than that in order to make it work. However, you can give it a try. First PLEASE backup your function file!!!
I think I know what the issue is. The dimension ncread complains about is nH which is the number of constituents. You are only using one of them, Q1 as I can see. In your file the variables such as h have only two dimensions. I think in TPXO files with more than one constituent they have another dimension which is equivalent to nH. I ran into the same issue when I just wanted to simulate M2. What I did was to insert an if-condition for nH being one and then removing nH as a dimension in the reading lines. However, this would be a larger overhaul of the code and one could easily get confused and mess up the beautiful work of John Luick.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
I suggest that you either wait for John Luick's solution or save the function file as a backup before you try and make the following changes:
Code: Select all
if length(ROMSnames) == 1
Z=complex(ncread(TPXOfile.elev,'hRe',[h.I(1) h.J(1)],[length(h.I) length(h.J)]),...
ncread(TPXOfile.elev,'hIm',[h.I(1) h.J(1)],[length(h.I) length(h.J)]));
TPXO.h.z(:,:)=double(Z);
else
Z=complex(ncread(TPXOfile.elev,'hRe',[h.I(1) h.J(1) nH],[length(h.I) length(h.J) 1]),...
ncread(TPXOfile.elev,'hIm',[h.I(1) h.J(1) nH],[length(h.I) length(h.J) 1]));
TPXO.h.z(:,:,nH)=double(Z);
end
Code: Select all
if length(ROMSnames) == 1
Z=complex(ncread(TPXOfile.vel,'uRe',[u.I(1) u.J(1)],[length(u.I) length(u.J)]),...
ncread(TPXOfile.vel,'uIm',[u.I(1) u.J(1)],[length(u.I) length(u.J)]));
Z=double(Z);
TPXO.U.z(:,:)=Z./repmat(TPXO.U.depth,[1 size(Z,2)]);
else
Z=complex(ncread(TPXOfile.vel,'uRe',[u.I(1) u.J(1) nH],[length(u.I) length(u.J) 1]),...
ncread(TPXOfile.vel,'uIm',[u.I(1) u.J(1) nH],[length(u.I) length(u.J) 1]));
Z=double(Z);
TPXO.U.z(:,:,nH)=Z./repmat(TPXO.U.depth,[1 1 size(Z,3)]);
end
Code: Select all
if length(ROMSnames) == 1
Z=complex(ncread(TPXOfile.vel,'vRe',[v.I(1) v.J(1)],[length(v.I) length(v.J)]),...
ncread(TPXOfile.vel,'vIm',[v.I(1) v.J(1)],[length(v.I) length(v.J)]));
Z=double(Z);
TPXO.V.z(:,:)=Z./repmat(TPXO.V.depth,[1 size(Z,2)]);
else
Z=complex(ncread(TPXOfile.vel,'vRe',[v.I(1) v.J(1) nH],[length(v.I) length(v.J) 1]),...
ncread(TPXOfile.vel,'vIm',[v.I(1) v.J(1) nH],[length(v.I) length(v.J) 1]));
Z=double(Z);
TPXO.V.z(:,:,nH)=Z./repmat(TPXO.V.depth,[1 1 size(Z,3)]);
end
BUT, I really have to admit that I am not sure if I had to change more than that in order to make it work. However, you can give it a try. First PLEASE backup your function file!!!
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks a lot Cate.
I just tested the suggestions you made by changing them accordingly in my script (I kept an original copy of the previous version of the scripts safe for backup). I ran into a rather unexpected error:
I don't know whats causing the error. is it that my TPXO2ROMS_v5pt1.m script isn't able to retrieve the variable from TPXO2ROMS_v5pt1_script.m accurately or is it something wrong in my grid ?
Any kind of help from anyone is appreciated to the fullest.
Kind Regards
-Neel
I just tested the suggestions you made by changing them accordingly in my script (I kept an original copy of the previous version of the scripts safe for backup). I ran into a rather unexpected error:
It's rather unexpected because I've checked the scripts quite a number of times now it's well defined in the TPXO2ROMS_v5pt1_script.m file by the name ROMSnames={'Q1'};>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Unrecognized function or variable 'ROMSnames'.
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 453)
if length(ROMSnames) == 1
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR);
Error in TPXO2ROMS_v5pt1_script (line 26)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
>>
I don't know whats causing the error. is it that my TPXO2ROMS_v5pt1.m script isn't able to retrieve the variable from TPXO2ROMS_v5pt1_script.m accurately or is it something wrong in my grid ?
Any kind of help from anyone is appreciated to the fullest.
Kind Regards
-Neel
- Attachments
-
TPXO2ROMS_v5pt1.m
- (23.62 KiB) Downloaded 1915 times
-
TPXO2ROMS_v5pt1_script.m
- (1.29 KiB) Downloaded 1866 times
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Nee,
yes, I know now I had to add the variable to the function readTPXOdata. Inside of the function file the code also calls subfunctions which need necessary variables passed on to them. readTPXOdata doesn't know ROMSnames in your file. You have to add it as a function variable:
in line 398.
and add the variable to the variables passed on to the function
in line 78.
Lets see how this works.![Smile :)](./images/smilies/icon_smile.gif)
yes, I know now I had to add the variable to the function readTPXOdata. Inside of the function file the code also calls subfunctions which need necessary variables passed on to them. readTPXOdata doesn't know ROMSnames in your file. You have to add it as a function variable:
Code: Select all
function TPXO=readTPXOdata(TPXOfile,lon,lat,ROMSnames)
and add the variable to the variables passed on to the function
Code: Select all
TPXO=readTPXOdata(TPXOfile,lonR,latR,ROMSnames);
Lets see how this works.
![Smile :)](./images/smilies/icon_smile.gif)
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks a lot Cate for constantly helping me out with my errors. I am highly indebted to you.
Unfortunately I am now in a belief that there's something wrong I guess with the grid file itself. I am constantly getting new error with every change you suggest. I guess I must have got the wrong grid file otherwise it shouldn't happen that the same script works for you and not for me. The error I got this time is new and is as follows:
.
I am not sure why this error occurred in the first place .
Any help in any form is extremely appreciated by me.
Thanks a lot.
-Neel
Unfortunately I am now in a belief that there's something wrong I guess with the grid file itself. I am constantly getting new error with every change you suggest. I guess I must have got the wrong grid file otherwise it shouldn't happen that the same script works for you and not for me. The error I got this time is new and is as follows:
Not sure what's the problem with dimension now. At this point I personally feel I've bothered you guys pretty well enough>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Matrix dimensions must agree.
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 468)
TPXO.U.z(:,:)=Z./repmat(TPXO.U.depth,[1 size(Z,2)]);
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR,ROMSnames);
Error in TPXO2ROMS_v5pt1_script (line 26)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
>>
![Sad :(](./images/smilies/icon_sad.gif)
![Sad :(](./images/smilies/icon_sad.gif)
![Sad :(](./images/smilies/icon_sad.gif)
I am not sure why this error occurred in the first place .
Any help in any form is extremely appreciated by me.
Thanks a lot.
-Neel
- Attachments
-
- grd_Vizhinjam.nc
- (7.67 MiB) Downloaded 1876 times
-
TPXO2ROMS_v5pt1.m
- (23.64 KiB) Downloaded 1810 times
-
TPXO2ROMS_v5pt1_script.m
- (1.29 KiB) Downloaded 1878 times
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
I am very sorry I couldn't help you solve the problems.
I suspect TPXO2ROMS_v5x is not compatible with TPXO9_atlas data but maybe I am wrong. TPXO9_atlas data has a very different structure than TPXO8 and even if John Luick writes in the comments of the function that there were a lot of changes made in accordance to the new file structure, maybe this is only valid for the non-atlas data.
All I can say is that TPXO2ROMS_v4x is well compatible with TPXO8_atlas data. So maybe you try and work with this for the first. You can find the v4 further up in this thread and the v8 TPXO atlas data is available upon request, too.
Good Luck!![Smile :)](./images/smilies/icon_smile.gif)
I am very sorry I couldn't help you solve the problems.
I suspect TPXO2ROMS_v5x is not compatible with TPXO9_atlas data but maybe I am wrong. TPXO9_atlas data has a very different structure than TPXO8 and even if John Luick writes in the comments of the function that there were a lot of changes made in accordance to the new file structure, maybe this is only valid for the non-atlas data.
All I can say is that TPXO2ROMS_v4x is well compatible with TPXO8_atlas data. So maybe you try and work with this for the first. You can find the v4 further up in this thread and the v8 TPXO atlas data is available upon request, too.
Good Luck!
![Smile :)](./images/smilies/icon_smile.gif)
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
tomorrow morning I will have another look. Meanwhile, could you download TPXO2ROMS_v5pt1.m again to ensure we are using the identical software, and try to run it with the Vizhinjam grid? Let me know what the error is, if you get one.
Cheers
John
tomorrow morning I will have another look. Meanwhile, could you download TPXO2ROMS_v5pt1.m again to ensure we are using the identical software, and try to run it with the Vizhinjam grid? Let me know what the error is, if you get one.
Cheers
John
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks a lot Cate for your help. Will definitely consider your suggestion. Good luck to you as well
Thanks a lot Mr. John, I again downloaded the TPXO to ROMS Express v. 5.1 zip file from https://austides.com/downloads/ as you had suggested. I chaned the portion of script which required giving the location of my files and filenames in both scripts as follows:
TPXO2ROMS_v5pt1_script.m:
TPXO2ROMS_v5pt1.m in lines 71-74:
The error I received is as follows:
Not sure if what this error is. I tried Cate's solution before (actually a series of modifications she suggested) but down the road, unfortunately it didn't work out pretty well. These are the location of my files and filenames present in my MATLAB path:
My location for files are as follows-
matlab_dir: C:\Users\aBc\Documents\MATLAB\TPXO
mexcdf: C:\Users\aBc\Documents\MATLAB\TPXO
netcdf_toolbox: C:\Users\aBc\Documents\MATLAB\TPXO
h_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
u_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
grid file on which i want forcing: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1_script.m: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1.m: C:\Users\aBc\Documents\MATLAB\TPXO
Looking forward to a positive reply.
Thanks a lot in advance.
-Neel
![Smile :)](./images/smilies/icon_smile.gif)
Thanks a lot Mr. John, I again downloaded the TPXO to ROMS Express v. 5.1 zip file from https://austides.com/downloads/ as you had suggested. I chaned the portion of script which required giving the location of my files and filenames in both scripts as follows:
TPXO2ROMS_v5pt1_script.m:
Code: Select all
%****************Modify to suit***************
TIDE_START=18485; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(1968,5,23); %TIDE_START in Matlab datenum
lengthSim=60; %approximate length of model run in days
fnGrid='C:\Users\aBc\Documents\MATLAB\TPXO\grd_Vizhinjam.nc';
fnOut=['C:\Users\aBc\Documents\MATLAB\TPXO\frc_TPXO9_Vizhinjam_' datestr(t0,'ddmmmyyyy') '.nc'];
ROMSnames={'Q1'};
%********************************************
Code: Select all
%TPXO filenames (files must be on Matlab path)
TPXOfile.grid='grid_tpxo9_atlas_v4.nc';
TPXOfile.elev='h_q1_tpxo9_atlas_30_v4.nc';
TPXOfile.vel='u_q1_tpxo9_atlas_30_v4.nc';
The error I received is as follows:
>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Index exceeds the number of array elements (0).
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 421)
TPXO.h.depth=ncread(TPXOfile.grid,'hz',[h.I(1) h.J(1)],[length(h.I) length(h.J)]); %bathymetry at z nodes
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR);
Error in TPXO2ROMS_v5pt1_script (line 27)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
Not sure if what this error is. I tried Cate's solution before (actually a series of modifications she suggested) but down the road, unfortunately it didn't work out pretty well. These are the location of my files and filenames present in my MATLAB path:
My location for files are as follows-
matlab_dir: C:\Users\aBc\Documents\MATLAB\TPXO
mexcdf: C:\Users\aBc\Documents\MATLAB\TPXO
netcdf_toolbox: C:\Users\aBc\Documents\MATLAB\TPXO
h_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
u_q1_tpxo9_atlas_30_v4.nc : C:\Users\aBc\Documents\MATLAB\TPXO
grid file on which i want forcing: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1_script.m: C:\Users\aBc\Documents\MATLAB\TPXO
TPXO2ROMS_v5pt1.m: C:\Users\aBc\Documents\MATLAB\TPXO
Looking forward to a positive reply.
Thanks a lot in advance.
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel
please replace your TPXO2ROMS_v5pt1.m with attached (TPXO2ROMS_v5pt2.m) and let me know if it works.
John
please replace your TPXO2ROMS_v5pt1.m with attached (TPXO2ROMS_v5pt2.m) and let me know if it works.
John
- Attachments
-
TPXO2ROMS_v5pt2.m
- (24.83 KiB) Downloaded 1871 times
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
I believe that my TPXO9 files are the ones I got i.e. TPXO9-atlas-v4 netcdf isn't what the script was made to extract tidal forcing from. I believe the script was meant to work on TPXO9v1 netcdf. I tried your new script TPXO2ROMS_v5pt2.m script and TPXO2ROMS_v5pt1_script.m script with the following error
Error :
Thanks a lot again Mr. John Luick.
I hope of not running running into troubles again.
-Neel
Error :
I had got access to TPXO9-atlas-v4 netcdf. Therefore when I tried the new script as provided by you, it showed same error. Therefore, I have requested Dr. Erofeeva agin for TPXO9v1 netcdf files. Maybe that will work. I will keep you posted. Then I will try with TPXO9v1 netcdf files , the same script. Will let you know of errors.>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Index exceeds the number of array elements (0).
Error in TPXO2ROMS_v5pt1>readTPXOdata (line 421)
TPXO.h.depth=ncread(TPXOfile.grid,'hz',[h.I(1) h.J(1)],[length(h.I) length(h.J)]); %bathymetry at z nodes
Error in TPXO2ROMS_v5pt1 (line 78)
TPXO=readTPXOdata(TPXOfile,lonR,latR);
Error in TPXO2ROMS_v5pt1_script (line 27)
TPXO2ROMS_v5pt1(t0,ROMSnames,fnGrid,fnOut,lengthSim)
Thanks a lot again Mr. John Luick.
I hope of not running running into troubles again.
-Neel
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel and John
the attached file is my Matlab function to read TPXO atlas data. I adapted it to the current TPXO9 version on the basis of John's TPXO2ROMS_v4 script. It works fine for me. It can read in several constituents after each other on the basis of individual TPXO files or just one, such as Q1. It just needs the right file names and paths. (I just adapted the M2 names). The TPXO path name may be empty if the files are in the Matlab working folder. I think it should work like that, too.
It is a bit hard coded in some places and the newest version 5 looks way more elegant than this, but for the atlas data maybe it's a working alternative.
Let me know if this works for you, too, Neel. You will have to change the name of the called function in the _script file, of course. And the names and paths to your TPXO constituent files. I press my thumbs!![Wink ;)](./images/smilies/icon_wink.gif)
the attached file is my Matlab function to read TPXO atlas data. I adapted it to the current TPXO9 version on the basis of John's TPXO2ROMS_v4 script. It works fine for me. It can read in several constituents after each other on the basis of individual TPXO files or just one, such as Q1. It just needs the right file names and paths. (I just adapted the M2 names). The TPXO path name may be empty if the files are in the Matlab working folder. I think it should work like that, too.
It is a bit hard coded in some places and the newest version 5 looks way more elegant than this, but for the atlas data maybe it's a working alternative.
![Smile :)](./images/smilies/icon_smile.gif)
Let me know if this works for you, too, Neel. You will have to change the name of the called function in the _script file, of course. And the names and paths to your TPXO constituent files. I press my thumbs!
![Wink ;)](./images/smilies/icon_wink.gif)
- Attachments
-
TPXO2ROMS.m
- (23.15 KiB) Downloaded 1874 times
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello Cate.
Thanks a lot for your constant help to me. The script was working extremely well (atleast better than all my previous iterations) till it encountered an error at this portion specifically line 141 in your script:
How should I remove this error in your script Cate ? 'Reference to non-existent field 'h' , have you got any clue as to how this reference can be created ? I think same errors might occur in in subsequent lines of 146(ei=interpTPXO(TPXO.U,harmonic,count,lonR,latR,maskR);) and 151(ei=interpTPXO(TPXO.V,harmonic,count,lonR,latR,maskR);) as all these lines are similar to line 141. I don't know for sure. You're an expert and can better guide me.
Is there something to do to remove this error ?
Any help is appreciated heartily.
-neel
Thanks a lot for your constant help to me. The script was working extremely well (atleast better than all my previous iterations) till it encountered an error at this portion specifically line 141 in your script:
P.S. I am using u_m2_tpxo9_atlas_30_v4.nc, h_m2_tpxo9_atlas_30_v4.nc and grid_tpxo9_atlas_v4.nc in the path C:\Users\aBc\Documents\MATLAB\TPXO\>> TPXO2ROMS_v5pt1_script
TPXO_path =
'C:\Users\aBc\Documents\MATLAB\TPXO\'
Reading TPXO
'Interpolating ' 'M2' ' amplitudes'
Reference to non-existent field 'h'.
Error in TPXO2ROMS (line 141)
ei=interpTPXO(TPXO.h,harmonic,count,lonR,latR,maskR);
Error in TPXO2ROMS_v5pt1_script (line 27)
TPXO2ROMS(t0,ROMSnames,fnGrid,fnOut,lengthSim)
>>
How should I remove this error in your script Cate ? 'Reference to non-existent field 'h' , have you got any clue as to how this reference can be created ? I think same errors might occur in in subsequent lines of 146(ei=interpTPXO(TPXO.U,harmonic,count,lonR,latR,maskR);) and 151(ei=interpTPXO(TPXO.V,harmonic,count,lonR,latR,maskR);) as all these lines are similar to line 141. I don't know for sure. You're an expert and can better guide me.
Is there something to do to remove this error ?
Any help is appreciated heartily.
-neel
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
I think the error comes from the line 617 and following. I forgot to mention that you also have to change the path to your grid file here or remove mine if your grid file is in the Matlab working folder:
Then it should work. ![Smile :)](./images/smilies/icon_smile.gif)
Cheers,
Cate
I think the error comes from the line 617 and following. I forgot to mention that you also have to change the path to your grid file here or remove mine if your grid file is in the Matlab working folder:
Code: Select all
elseif strcmp(TPXOfile_grid,'grid_tpxo9_atlas_v4.nc');
![Smile :)](./images/smilies/icon_smile.gif)
Cheers,
Cate
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello Cate
Thanks a lot for your script. It moved a step ahead until it met the error:
Any form of help is appreciated.
Regards
-Neel
Thanks a lot for your script. It moved a step ahead until it met the error:
Any clue on what might cause this error ?>> TPXO2ROMS_v5pt1_script
TPXO_path =
'C:\Users\aBc\Documents\MATLAB\TPXO\'
Reading TPXO
'Interpolating ' 'M2' ' amplitudes'
Warning: Insufficient number of data points to create a triangulation-based interpolant.
> In TPXO2ROMS>interpTPXO (line 397)
In TPXO2ROMS (line 141)
In TPXO2ROMS_v5pt1_script (line 27)
Error using griddedInterpolant
The grid vectors do not define a grid of points that match the given values.
Error in TPXO2ROMS>interpTPXO (line 398)
F=griddedInterpolant(x',y',z');
Error in TPXO2ROMS (line 141)
ei=interpTPXO(TPXO.h,harmonic,count,lonR,latR,maskR);
Error in TPXO2ROMS_v5pt1_script (line 27)
TPXO2ROMS(t0,ROMSnames,fnGrid,fnOut,lengthSim)
Any form of help is appreciated.
Regards
-Neel
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello Cate and John
I have a ran into an error while running my grid file which I made using GridBuilder .exe tool version 0.99.5
First and foremost a very very hearty gratitude for all your help and efforts. The script sent by you gentle humans got the grid file which was sent for test by Mr. John Luick ' grd_Vizhinjam.nc' is up and running with outputs . I am attaching the script as a reference for future help seekers.
I'm not sure what's wrong with my own grid on which I want to work on is causing an error:
Thanks a lot in advance and extreme thanks for all the support you guys gave me all the time.
Regards
-Neel
I have a ran into an error while running my grid file which I made using GridBuilder .exe tool version 0.99.5
First and foremost a very very hearty gratitude for all your help and efforts. The script sent by you gentle humans got the grid file which was sent for test by Mr. John Luick ' grd_Vizhinjam.nc' is up and running with outputs . I am attaching the script as a reference for future help seekers.
I'm not sure what's wrong with my own grid on which I want to work on is causing an error:
Not sure what's the error in it . If you guys could help me out with the grid file as to what is causing this error and how to remove it, then it would be highly beneficial for me. Is it a problem with gridbuilder tool that the grid file has defects ?>> TPXO2ROMS_v5pt1_script
Reading TPXO data
Finished reading
Interpolating M2 amplitudes
Artifically doubling TPXO grid resolution
Interpolating M2 u components
Interpolating M2 v components
Warning: Insufficient number of data points to create a triangulation-based interpolant.
> In TPXO2ROMS_v5pt2>interpTPXO (line 424)
In TPXO2ROMS_v5pt2 (line 177)
In TPXO2ROMS_v5pt1_script (line 27)
Error using griddedInterpolant
Sample values must be a single or double array.
Error in TPXO2ROMS_v5pt2>doubleResolution (line 692)
F=griddedInterpolant(xA',yA',varA');
Error in TPXO2ROMS_v5pt2 (line 181)
mask=doubleResolution(TPXO.V.mask,factor);
Error in TPXO2ROMS_v5pt1_script (line 27)
TPXO2ROMS_v5pt2(t0,ROMSnames,fnGrid,fnOut,lengthSim)
>>
Thanks a lot in advance and extreme thanks for all the support you guys gave me all the time.
Regards
-Neel
- Attachments
-
TPXO2ROMS_v5pt1_script.m
- (1.37 KiB) Downloaded 2276 times
-
TPXO2ROMS_v5pt2.m
- (24.83 KiB) Downloaded 2271 times
-
- ROMS_grid_alderneyrace_new.nc
- The grid that's causing this error using these scripts
- (6.85 MiB) Downloaded 1861 times
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel
it is pretty obvious that you have chosen some parameter or set of parameters in GridBuilder which is causing the problem in TPXO2ROMS. The GridBuilder guru, Charles James, is on leave at the moment so probably won't be able to help you with that for a week or two. There is something strange about the fact that you have 300 cells in M, only 150 in L, the M axis is much shorter than the L axis, yet your cells are nearly square.
Meanwhile, I am attaching an Alderney grid that I created. TPXO2ROMS has no problem with it. I recommend you "Import" it into GridBuilder, edit the mask, export it, test it with TPXO2ROMS, modify a few parameters from the menu on the right hand side in strict accordance with the reference guide under "Help", then again test it with TPXO2ROMS, modify a few more parameters, repeat, etc. Don't change any of the defaults unless you have good reason to. This will get you going with some actual modelling.
All I did was set up the grid (choose boundaries) and set the minimum depth to +2 metres (my normal practice). I didn't touch the "Modify Z coordinate" or other things. I saw no point in putting the grid at an angle (as you did). (Actually I never have a grid at an angle unless absolutely necessary, which is almost never. KISS principle.) Oh yes, another thing I did which I consider to be of paramount importance, unless you want to go insane, is set the pivot corner to lower left hand (just drag the blue diamond down from whatever corner it is, to LLH).
In brief summary, I recommend you abandon the grid you created, and start over, without trying to get cute with the orthogonality and other options.
Good luck
John
it is pretty obvious that you have chosen some parameter or set of parameters in GridBuilder which is causing the problem in TPXO2ROMS. The GridBuilder guru, Charles James, is on leave at the moment so probably won't be able to help you with that for a week or two. There is something strange about the fact that you have 300 cells in M, only 150 in L, the M axis is much shorter than the L axis, yet your cells are nearly square.
Meanwhile, I am attaching an Alderney grid that I created. TPXO2ROMS has no problem with it. I recommend you "Import" it into GridBuilder, edit the mask, export it, test it with TPXO2ROMS, modify a few parameters from the menu on the right hand side in strict accordance with the reference guide under "Help", then again test it with TPXO2ROMS, modify a few more parameters, repeat, etc. Don't change any of the defaults unless you have good reason to. This will get you going with some actual modelling.
All I did was set up the grid (choose boundaries) and set the minimum depth to +2 metres (my normal practice). I didn't touch the "Modify Z coordinate" or other things. I saw no point in putting the grid at an angle (as you did). (Actually I never have a grid at an angle unless absolutely necessary, which is almost never. KISS principle.) Oh yes, another thing I did which I consider to be of paramount importance, unless you want to go insane, is set the pivot corner to lower left hand (just drag the blue diamond down from whatever corner it is, to LLH).
In brief summary, I recommend you abandon the grid you created, and start over, without trying to get cute with the orthogonality and other options.
Good luck
John
- Attachments
-
- ROMS_grid_alderneyrace_v1.nc
- (6.85 MiB) Downloaded 1912 times
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Extremely sorry for my late reply.
Thank you so much for your guidance and help. I have now created my own new grid for the region and kept the parameters as simple as possible. I took my references from the help menu and the suggestions you very generously made to me. Although the grid didn't turn out as good as yours but I learned a lot and thank you heartily for all the pain you took to sort my naïve queries out.
Once again thanks a lot Mr. John and Cate for helping me with everything I need.
Kind regards
-Neel
Thank you so much for your guidance and help. I have now created my own new grid for the region and kept the parameters as simple as possible. I took my references from the help menu and the suggestions you very generously made to me. Although the grid didn't turn out as good as yours but I learned a lot and thank you heartily for all the pain you took to sort my naïve queries out.
Once again thanks a lot Mr. John and Cate for helping me with everything I need.
Kind regards
-Neel
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Mr. John,johnluick wrote: ↑Tue Jan 19, 2021 12:19 am Hi Neel
it is pretty obvious that you have chosen some parameter or set of parameters in GridBuilder which is causing the problem in TPXO2ROMS. The GridBuilder guru, Charles James, is on leave at the moment so probably won't be able to help you with that for a week or two. There is something strange about the fact that you have 300 cells in M, only 150 in L, the M axis is much shorter than the L axis, yet your cells are nearly square.
Meanwhile, I am attaching an Alderney grid that I created. TPXO2ROMS has no problem with it. I recommend you "Import" it into GridBuilder, edit the mask, export it, test it with TPXO2ROMS, modify a few parameters from the menu on the right hand side in strict accordance with the reference guide under "Help", then again test it with TPXO2ROMS, modify a few more parameters, repeat, etc. Don't change any of the defaults unless you have good reason to. This will get you going with some actual modelling.
All I did was set up the grid (choose boundaries) and set the minimum depth to +2 metres (my normal practice). I didn't touch the "Modify Z coordinate" or other things. I saw no point in putting the grid at an angle (as you did). (Actually I never have a grid at an angle unless absolutely necessary, which is almost never. KISS principle.) Oh yes, another thing I did which I consider to be of paramount importance, unless you want to go insane, is set the pivot corner to lower left hand (just drag the blue diamond down from whatever corner it is, to LLH).
In brief summary, I recommend you abandon the grid you created, and start over, without trying to get cute with the orthogonality and other options.
Good luck
John
Greetings
I was working with TPXO9 script sent by you and all was working well. I was able to generate the output .nc as well.
But today when I was again working with the script, it showed some error that I hadn't previously encountered:
I then tried to check with the previous grids i had worked on using this script but it showed the aforementioned error for those as well including the grd_Vizhinjam.nc file. These were the same scripts that were earlier working perfectly fine but now i don't know why it throws this error.TPXO2ROMS_v5pt1_script
Reading TPXO data
Finished reading
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt1_script (line 27)
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in TPXO2ROMS_v5pt2 (line 114)
ROMSharmonics(nR,:)=TPXOharmonicData(nT,:);
Error in TPXO2ROMS_v5pt1_script (line 27)
I checked Nharmonics variable and it seems okay to me. nR and nT also seemed okay as they should have integer values. But what might the the reason for this error? How should I remove this error ?
I am extremely sorry for bugging you again.
Thanks a lot in advance.
Kind regards
-Neel
- Attachments
-
TPXO2ROMS_v5pt2.m
- (24.83 KiB) Downloaded 1800 times
-
TPXO2ROMS_v5pt1_script.m
- (1.3 KiB) Downloaded 1882 times
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
can you repeat the exercise, but with TPXO2ROMS_v5pt2_script.m (instead of TPXO2ROMS_v5pt1_script.m), and let me know what happens?
If it works, I recommend deleting v5pt1, to remove future confusion.
Cheers
John
can you repeat the exercise, but with TPXO2ROMS_v5pt2_script.m (instead of TPXO2ROMS_v5pt1_script.m), and let me know what happens?
If it works, I recommend deleting v5pt1, to remove future confusion.
Cheers
John
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear Mr. John, I repeated the process using TPXO2ROMS_v5pt2_script.m downloaded from austides website. Sorry for writing it down here without checking the austides websites again. But again I'm being shown the same error again :
Is it a problem with my MATLAB version ? I'm using MATLAB 2019b and I don't think it should be a problem. I checked grid file as well grd_Vizhinjam.nc, same as the previous one which worked. I have all my mexcdf and snctools files in the same directory added to the path as well. How should i remove this error ?>> TPXO2ROMS_v5pt2_script
Reading TPXO data
Finished reading
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in TPXO2ROMS_v5pt2 (line 114)
ROMSharmonics(nR,:)=TPXOharmonicData(nT,:);
Error in TPXO2ROMS_v5pt2_script (line 338)
TPXO2ROMS_v5pt2(t0,ROMSnames,fnGrid,fnOut,lengthSim)
P.S. I am using grid_tpxo9.v4a.nc, h_tpxo9.v4a.nc ,u_tpxo9.v4a.nc files. It had worked fine earlier.
Any help in any form is deeply appreciated by me.
Kind regards
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
sorry for the delay. I was interstate. As an experiment to see if I could live without my laptop for two days, I did not bring it along. Yes, I survived.
I downloaded and ran your TPXO2ROMS script file and TRXO2ROMS.m, and they worked fine. The only changes I made were to the file paths in the script file, and I change the names of the TPXO files back to my versions of TPXO9 as follows:
%TPXO filenames (files must be on Matlab path)
TPXOfile.grid='grid_tpxo9.nc';
TPXOfile.elev='h_tpxo9.v1.nc';
TPXOfile.vel='u_tpxo9.v1.nc';
%TPXOfile.grid='grid_tpxo9.v4a.nc';
%TPXOfile.elev='h_tpxo9.v4a.nc';
%TPXOfile.vel='u_tpxo9.v4a.nc';
Apparently they have changed something about the character array in TPXO9 version v4a (the characters that are read into TPXO.harmonicNames). I will look into that when I can, and create a new version of TPXO2ROMS if necessary. Meanwhile, if you still have an older version of the TPXO data ( for example, v1) it should work.
I would be interested in the result of the following test using v4a. Pause the code at the line that fails (I think it was line 109)
I mean this line: cmp=strcmp(deblank(TPXO.harmonicNames(k,1:4)),ROMSnames{nR});
Then enter the following:
K>> dd=deblank(TPXO.harmonicNames(13,1:4))
You should get the following result:
dd = 'MS4'
Then enter:
K>> whos dd
You should get:
Name Size Bytes Class Attributes
dd 1x3 6 char
Cheers
John
sorry for the delay. I was interstate. As an experiment to see if I could live without my laptop for two days, I did not bring it along. Yes, I survived.
I downloaded and ran your TPXO2ROMS script file and TRXO2ROMS.m, and they worked fine. The only changes I made were to the file paths in the script file, and I change the names of the TPXO files back to my versions of TPXO9 as follows:
%TPXO filenames (files must be on Matlab path)
TPXOfile.grid='grid_tpxo9.nc';
TPXOfile.elev='h_tpxo9.v1.nc';
TPXOfile.vel='u_tpxo9.v1.nc';
%TPXOfile.grid='grid_tpxo9.v4a.nc';
%TPXOfile.elev='h_tpxo9.v4a.nc';
%TPXOfile.vel='u_tpxo9.v4a.nc';
Apparently they have changed something about the character array in TPXO9 version v4a (the characters that are read into TPXO.harmonicNames). I will look into that when I can, and create a new version of TPXO2ROMS if necessary. Meanwhile, if you still have an older version of the TPXO data ( for example, v1) it should work.
I would be interested in the result of the following test using v4a. Pause the code at the line that fails (I think it was line 109)
I mean this line: cmp=strcmp(deblank(TPXO.harmonicNames(k,1:4)),ROMSnames{nR});
Then enter the following:
K>> dd=deblank(TPXO.harmonicNames(13,1:4))
You should get the following result:
dd = 'MS4'
Then enter:
K>> whos dd
You should get:
Name Size Bytes Class Attributes
dd 1x3 6 char
Cheers
John
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear Mr. John
Thanks a lot for your kind reply.
I think I had figured out the problem yesterday when I was working, I am not sure if it's correct. I made the change and it started working again but then I'm not sure what I've done is healthy or not .
While running the code in debug mode I found out that even after successive iteration in the loop nT value wasn't changing from an initially set 0. I checked the value of cmp and it was 0 after every pass in the loop so what I did was I just changed if cmp condition to
Then I saw that nT variable was incrementing as was required by the script and it successfully generated the output file. Again I'm not sure if what I have done is right or wrong or just a bad patchment work. I checked it with tpxo9_v4a.nc files itself as I have access only to that database. It is working as it seems to me.
You are the expert in this Mr. John, maybe you could comment whether it's correct or not .
Kind regards
-Neel
Thanks a lot for your kind reply.
I think I had figured out the problem yesterday when I was working, I am not sure if it's correct. I made the change and it started working again but then I'm not sure what I've done is healthy or not .
Code: Select all
for nR=1:Nharmonics
nT=0;
for k=1:NTPXO
cmp=strcmp(deblank(TPXO.harmonicNames(k,1:4)),ROMSnames{nR});
if cmp
nT=k;
end
end
Code: Select all
if cmp==0
nT=k;
end
end
You are the expert in this Mr. John, maybe you could comment whether it's correct or not .
Kind regards
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Neel,
I have been told there was no format change between v1 and v4, so there must be a problem in your inputs. Can you please post the ten or so input lines from your TPXO2ROMS_v5pt2_script.m, and also post the lines that are displayed when you change that section of code to:
if cmp
nT=k;
disp([deblank(TPXO.harmonicNames(k,1:4)),' ',ROMSnames{nR}]) %New 11Feb2021
end
No, I do not think your change will produce the correct result.
Thanks
John
I have been told there was no format change between v1 and v4, so there must be a problem in your inputs. Can you please post the ten or so input lines from your TPXO2ROMS_v5pt2_script.m, and also post the lines that are displayed when you change that section of code to:
if cmp
nT=k;
disp([deblank(TPXO.harmonicNames(k,1:4)),' ',ROMSnames{nR}]) %New 11Feb2021
end
No, I do not think your change will produce the correct result.
Thanks
John
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear Mr. John,
Thanks for the reply.
Here is my input lines in the TPXO2ROMS_v5pt2_script.m file:
After the I changed the code to the one you suggested I didnot get any specific output pertaining to the line disp([deblank(TPXO.harmonicNames(k,1:4)),' ',ROMSnames{nR}]) %New 11Feb2021. Instead I receive the error message as follows when I run the script:
Part of the code looks like this :
And all the values as seen from the workspace window looks like the attachment image.
What might be going wrong in that case ? I believe the script is working for you. I haven't really made any changes to it except for the time initialization which I needed according to my other files.
Kind regards
-Neel
Thanks for the reply.
Here is my input lines in the TPXO2ROMS_v5pt2_script.m file:
Code: Select all
%****************Alderney Race***************
RUNTPXO=1; %set to 0 to skip computation - handy for playing with the plot only
TIDE_START=3042; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(2011,1,1); %TIDE_START in Matlab datenum
lengthSim=30; %approximate length of model run in days
fnGrid='C:\Users\aBc\Documents\MATLAB\TPXO\ROMS_alderney_z_test.nc';
fnOut=['C:\Users\aBc\Documents\MATLAB\TPXO\frc_TPXO9_alderneyv1' datestr(t0,'ddmmmyyyy') '_v4a.nc'];
ROMSnames={'MM' 'MF' 'Q1' 'O1' 'P1' 'K1' 'N2' 'M2' 'S2' 'K2' 'MN4' 'M4' 'MS4' '2N2' 'S1'};
% Hplot, skip, sfac, and smaj are parameters for the ellipse map
% Hplot='Q1'; %Which harmonic to plot (name one, e.g. 'M2', 'K1', etc.)
% skip=10; %plot each skipth'th ellipse
% sfac=0.1; %sf=scalefactor (the ellipse sizes are arbitrary)
% smaj=1; %Semi-major axis of scale factor ellipse
As far as my understanding after executing the code I see , line 109 - " cmp=strcmp(deblank(TPXO.harmonicNames(k,1:4)),ROMSnames{nR});" after execution cmp value remains 0 after every iteration of the loop.>> TPXO2ROMS_v5pt2_script
Reading TPXO data
Finished reading
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 109)
In TPXO2ROMS_v5pt2_script (line 338)
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in TPXO2ROMS_v5pt2 (line 115)
ROMSharmonics(nR,:)=TPXOharmonicData(nT,:);
Error in TPXO2ROMS_v5pt2_script (line 338)
TPXO2ROMS_v5pt2(t0,ROMSnames,fnGrid,fnOut,lengthSim)
Part of the code looks like this :
Code: Select all
Nharmonics=length(ROMSnames);
NTPXO=length(TPXO.harmonicNames);
ROMSperiods=zeros(1,Nharmonics);
ROMSharmonics=zeros(Nharmonics,8);
Vdeg=zeros(Nharmonics,1);
for nR=1:Nharmonics
nT=0;
for k=1:NTPXO
cmp=strcmp(deblank(TPXO.harmonicNames(k,1:4)),ROMSnames{nR});
if cmp
nT=k;
disp([deblank(TPXO.harmonicNames(k,1:4)),' ',ROMSnames{nR}]) %New 11Feb2021
end
end
ROMSharmonics(nR,:)=TPXOharmonicData(nT,:);
What might be going wrong in that case ? I believe the script is working for you. I haven't really made any changes to it except for the time initialization which I needed according to my other files.
Kind regards
-Neel
- Attachments
-
- Workspace details
- Screenshot 2021-02-11 093917.jpg (43.6 KiB) Viewed 3593510 times
-
TPXO2ROMS_v5pt2_script.m
- (21.64 KiB) Downloaded 1806 times
-
TPXO2ROMS_v5pt2.m
- (24.92 KiB) Downloaded 1804 times
-
- Posts: 110
- Joined: Thu Mar 08, 2018 2:47 am
- Location: German Research Centre for Geosciences
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel!
It seems like the string comparison never finds a match. So I guess there is something wrong with the reading of the constituents from the file. In line 486 of TPXO2ROMS_v5pt2.m you can see that the harmonicNames are read from the variable "con" in the elevation file. Can you check if the file h_tpxo9.v4a.nc has the variable "con" in it?
To John Luick: The function uses nc_varget here which is not a native Matlab function. Is there a reason why?
Cheers,
Cate
It seems like the string comparison never finds a match. So I guess there is something wrong with the reading of the constituents from the file. In line 486 of TPXO2ROMS_v5pt2.m you can see that the harmonicNames are read from the variable "con" in the elevation file. Can you check if the file h_tpxo9.v4a.nc has the variable "con" in it?
To John Luick: The function uses nc_varget here which is not a native Matlab function. Is there a reason why?
Cheers,
Cate
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel,
Change that section of code to:
for nR=1:Nharmonics
disp(['nR = ', num2str(nR)])
nT=0;
for k=1:NTPXO
s1=deblank(TPXO.harmonicNames(k,1:4));
s2=ROMSnames{nR};
disp([s1,' ',s2])
cmp=strcmp(s1,s2);
if cmp
nT=k;
disp(['k = ',num2str(k)])
end
end
ROMSharmonics(nR,:)=TPXOharmonicData(nT,:);
%ROMSharmonics.(ROMSnames{n})=TPXOharmonicData(nT,:);
ROMSperiods(nR)=360./TPXOharmonicData(nT,end);
Vdeg(nR)=Vphase(t0,ROMSharmonics(nR,:));
%Vdeg.(ROMSnames{n})=Vphase(t0,ROMSharmonics.(ROMSnames{n}));
end
It is the same but with a couple of new disp statements.
I suggest you also put a debug stop after that section to stop it from going further.
Using your script with 15 harmonics, the following was displayed to my screen:
>> TPXO2ROMS_v5pt2_script
Reading TPXO data
Finished reading
nR = 1
M2 MM
S2 MM
N2 MM
K2 MM
K1 MM
O1 MM
P1 MM
Q1 MM
MM MM
k = 9
MF MM
M4 MM
MN4 MM
MS4 MM
2N2 MM
S1 MM
nR = 2
M2 MF
S2 MF
N2 MF
K2 MF
K1 MF
O1 MF
P1 MF
Q1 MF
MM MF
MF MF
k = 10
M4 MF
MN4 MF
MS4 MF
2N2 MF
S1 MF
nR = 3
M2 Q1
S2 Q1
N2 Q1
K2 Q1
K1 Q1
O1 Q1
P1 Q1
Q1 Q1
k = 8
MM Q1
MF Q1
M4 Q1
MN4 Q1
MS4 Q1
2N2 Q1
S1 Q1
nR = 4
M2 O1
S2 O1
N2 O1
K2 O1
K1 O1
O1 O1
k = 6
P1 O1
Q1 O1
MM O1
MF O1
M4 O1
MN4 O1
MS4 O1
2N2 O1
S1 O1
nR = 5
M2 P1
S2 P1
N2 P1
K2 P1
K1 P1
O1 P1
P1 P1
k = 7
Q1 P1
MM P1
MF P1
M4 P1
MN4 P1
MS4 P1
2N2 P1
S1 P1
nR = 6
M2 K1
S2 K1
N2 K1
K2 K1
K1 K1
k = 5
O1 K1
P1 K1
Q1 K1
MM K1
MF K1
M4 K1
MN4 K1
MS4 K1
2N2 K1
S1 K1
nR = 7
M2 N2
S2 N2
N2 N2
k = 3
K2 N2
K1 N2
O1 N2
P1 N2
Q1 N2
MM N2
MF N2
M4 N2
MN4 N2
MS4 N2
2N2 N2
S1 N2
nR = 8
M2 M2
k = 1
S2 M2
N2 M2
K2 M2
K1 M2
O1 M2
P1 M2
Q1 M2
MM M2
MF M2
M4 M2
MN4 M2
MS4 M2
2N2 M2
S1 M2
nR = 9
M2 S2
S2 S2
k = 2
N2 S2
K2 S2
K1 S2
O1 S2
P1 S2
Q1 S2
MM S2
MF S2
M4 S2
MN4 S2
MS4 S2
2N2 S2
S1 S2
nR = 10
M2 K2
S2 K2
N2 K2
K2 K2
k = 4
K1 K2
O1 K2
P1 K2
Q1 K2
MM K2
MF K2
M4 K2
MN4 K2
MS4 K2
2N2 K2
S1 K2
nR = 11
M2 MN4
S2 MN4
N2 MN4
K2 MN4
K1 MN4
O1 MN4
P1 MN4
Q1 MN4
MM MN4
MF MN4
M4 MN4
MN4 MN4
k = 12
MS4 MN4
2N2 MN4
S1 MN4
nR = 12
M2 M4
S2 M4
N2 M4
K2 M4
K1 M4
O1 M4
P1 M4
Q1 M4
MM M4
MF M4
M4 M4
k = 11
MN4 M4
MS4 M4
2N2 M4
S1 M4
nR = 13
M2 MS4
S2 MS4
N2 MS4
K2 MS4
K1 MS4
O1 MS4
P1 MS4
Q1 MS4
MM MS4
MF MS4
M4 MS4
MN4 MS4
MS4 MS4
k = 13
2N2 MS4
S1 MS4
nR = 14
M2 2N2
S2 2N2
N2 2N2
K2 2N2
K1 2N2
O1 2N2
P1 2N2
Q1 2N2
MM 2N2
MF 2N2
M4 2N2
MN4 2N2
MS4 2N2
2N2 2N2
k = 14
S1 2N2
nR = 15
M2 S1
S2 S1
N2 S1
K2 S1
K1 S1
O1 S1
P1 S1
Q1 S1
MM S1
MF S1
M4 S1
MN4 S1
MS4 S1
2N2 S1
S1 S1
k = 15
Please tell me what you get.
Cheers
John
Change that section of code to:
for nR=1:Nharmonics
disp(['nR = ', num2str(nR)])
nT=0;
for k=1:NTPXO
s1=deblank(TPXO.harmonicNames(k,1:4));
s2=ROMSnames{nR};
disp([s1,' ',s2])
cmp=strcmp(s1,s2);
if cmp
nT=k;
disp(['k = ',num2str(k)])
end
end
ROMSharmonics(nR,:)=TPXOharmonicData(nT,:);
%ROMSharmonics.(ROMSnames{n})=TPXOharmonicData(nT,:);
ROMSperiods(nR)=360./TPXOharmonicData(nT,end);
Vdeg(nR)=Vphase(t0,ROMSharmonics(nR,:));
%Vdeg.(ROMSnames{n})=Vphase(t0,ROMSharmonics.(ROMSnames{n}));
end
It is the same but with a couple of new disp statements.
I suggest you also put a debug stop after that section to stop it from going further.
Using your script with 15 harmonics, the following was displayed to my screen:
>> TPXO2ROMS_v5pt2_script
Reading TPXO data
Finished reading
nR = 1
M2 MM
S2 MM
N2 MM
K2 MM
K1 MM
O1 MM
P1 MM
Q1 MM
MM MM
k = 9
MF MM
M4 MM
MN4 MM
MS4 MM
2N2 MM
S1 MM
nR = 2
M2 MF
S2 MF
N2 MF
K2 MF
K1 MF
O1 MF
P1 MF
Q1 MF
MM MF
MF MF
k = 10
M4 MF
MN4 MF
MS4 MF
2N2 MF
S1 MF
nR = 3
M2 Q1
S2 Q1
N2 Q1
K2 Q1
K1 Q1
O1 Q1
P1 Q1
Q1 Q1
k = 8
MM Q1
MF Q1
M4 Q1
MN4 Q1
MS4 Q1
2N2 Q1
S1 Q1
nR = 4
M2 O1
S2 O1
N2 O1
K2 O1
K1 O1
O1 O1
k = 6
P1 O1
Q1 O1
MM O1
MF O1
M4 O1
MN4 O1
MS4 O1
2N2 O1
S1 O1
nR = 5
M2 P1
S2 P1
N2 P1
K2 P1
K1 P1
O1 P1
P1 P1
k = 7
Q1 P1
MM P1
MF P1
M4 P1
MN4 P1
MS4 P1
2N2 P1
S1 P1
nR = 6
M2 K1
S2 K1
N2 K1
K2 K1
K1 K1
k = 5
O1 K1
P1 K1
Q1 K1
MM K1
MF K1
M4 K1
MN4 K1
MS4 K1
2N2 K1
S1 K1
nR = 7
M2 N2
S2 N2
N2 N2
k = 3
K2 N2
K1 N2
O1 N2
P1 N2
Q1 N2
MM N2
MF N2
M4 N2
MN4 N2
MS4 N2
2N2 N2
S1 N2
nR = 8
M2 M2
k = 1
S2 M2
N2 M2
K2 M2
K1 M2
O1 M2
P1 M2
Q1 M2
MM M2
MF M2
M4 M2
MN4 M2
MS4 M2
2N2 M2
S1 M2
nR = 9
M2 S2
S2 S2
k = 2
N2 S2
K2 S2
K1 S2
O1 S2
P1 S2
Q1 S2
MM S2
MF S2
M4 S2
MN4 S2
MS4 S2
2N2 S2
S1 S2
nR = 10
M2 K2
S2 K2
N2 K2
K2 K2
k = 4
K1 K2
O1 K2
P1 K2
Q1 K2
MM K2
MF K2
M4 K2
MN4 K2
MS4 K2
2N2 K2
S1 K2
nR = 11
M2 MN4
S2 MN4
N2 MN4
K2 MN4
K1 MN4
O1 MN4
P1 MN4
Q1 MN4
MM MN4
MF MN4
M4 MN4
MN4 MN4
k = 12
MS4 MN4
2N2 MN4
S1 MN4
nR = 12
M2 M4
S2 M4
N2 M4
K2 M4
K1 M4
O1 M4
P1 M4
Q1 M4
MM M4
MF M4
M4 M4
k = 11
MN4 M4
MS4 M4
2N2 M4
S1 M4
nR = 13
M2 MS4
S2 MS4
N2 MS4
K2 MS4
K1 MS4
O1 MS4
P1 MS4
Q1 MS4
MM MS4
MF MS4
M4 MS4
MN4 MS4
MS4 MS4
k = 13
2N2 MS4
S1 MS4
nR = 14
M2 2N2
S2 2N2
N2 2N2
K2 2N2
K1 2N2
O1 2N2
P1 2N2
Q1 2N2
MM 2N2
MF 2N2
M4 2N2
MN4 2N2
MS4 2N2
2N2 2N2
k = 14
S1 2N2
nR = 15
M2 S1
S2 S1
N2 S1
K2 S1
K1 S1
O1 S1
P1 S1
Q1 S1
MM S1
MF S1
M4 S1
MN4 S1
MS4 S1
2N2 S1
S1 S1
k = 15
Please tell me what you get.
Cheers
John
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear Mr. John, I did what you had suggested me to do and received the following while running in debug mode :
And after this the script execution ended. This is the same error which I had earlier posted.>> TPXO2ROMS_v5pt2_script
Reading TPXO data
Finished reading
nR = 1
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
m2 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
s2 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
n2 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
k2 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
k1 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
o1 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
p1 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
q1 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
mm MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
mf MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
m4 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
mn4 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
ms4 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
2n2 MM
Warning: Input should be a string, character array, or cell array of character arrays.
> In TPXO2ROMS_v5pt2 (line 110)
In TPXO2ROMS_v5pt2_script (line 338)
s1 MM
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in TPXO2ROMS_v5pt2 (line 119)
ROMSharmonics(nR,:)=TPXOharmonicData(nT,:);
Error in TPXO2ROMS_v5pt2_script (line 338)
TPXO2ROMS_v5pt2(t0,ROMSnames,fnGrid,fnOut,lengthSim)
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks Cate for your advice. I checked my h_tpxo9.v4a.nc file in matlab using ncdisp command and it seems fine. Here's a portion of the output :c.drinkorn wrote: ↑Thu Feb 11, 2021 9:20 am Hi Neel!
It seems like the string comparison never finds a match. So I guess there is something wrong with the reading of the constituents from the file. In line 486 of TPXO2ROMS_v5pt2.m you can see that the harmonicNames are read from the variable "con" in the elevation file. Can you check if the file h_tpxo9.v4a.nc has the variable "con" in it?
To John Luick: The function uses nc_varget here which is not a native Matlab function. Is there a reason why?
Cheers,
Cate
It had a bunch of other variables as well but I didn't post it here.file='h_tpxo9.v4a.nc'
file =
'h_tpxo9.v4a.nc'
>> ncdisp(file)
Source:
C:\Users\aBc\Documents\MATLAB\TPXO\h_tpxo9.v4a.nc
Format:
classic
Global Attributes:
type = 'OTIS tidal elevation file'
title = 'TPXO9.v4a 2020 tidal elevation file: open ocean - TPXO9.v1, coastal - averaged TPXO9-atlas-v4'
Dimensions:
nx = 2160
ny = 1081
nc = 15
nct = 4
Variables:
con
Size: 4x15
Dimensions: nct,nc
Datatype: char
Attributes:
log_name = 'tidal constituents'
lon_z
Size: 1081x2160
Dimensions: ny,nx
Datatype: double
Attributes:
long_name = 'longitude of Z nodes'
units = 'degree_east'
lat_z
Size: 1081x2160
Dimensions: ny,nx
Datatype: double
Attributes:
long_name = 'latitude of Z nodes'
units = 'degree_north'
Kind regards
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Cate is right (thank you, Cate!). The line at or near 486 in TPXO2ROMS_v5pt2.m, which currently reads
harmonicNames=upper(nc_varget(TPXOfile.elev,'con'));
must be changed to two lines:
harmonicNames=upper(ncread(TPXOfile.elev,'con'));
harmonicNames=permute(harmonicNames,[2,1]);
I will put a new v5pt3 online asap with this change.
My apologies to Neel.
In case you are interested, I think this is what happened. The original version was written before the native Matlab tools for reading netcdf became available (i.e., the command before ncread existed). So, like most people, I used snctools (e.g., command nc_varget). At some point, I converted TPXO2ROMS to native tools (ncread etc.), but somehow I missed that line. For me and anyone else with snctools in their path, it still worked.
What I do not understand is why Neel did not get an error message at line 486.
Cheers
John
harmonicNames=upper(nc_varget(TPXOfile.elev,'con'));
must be changed to two lines:
harmonicNames=upper(ncread(TPXOfile.elev,'con'));
harmonicNames=permute(harmonicNames,[2,1]);
I will put a new v5pt3 online asap with this change.
My apologies to Neel.
In case you are interested, I think this is what happened. The original version was written before the native Matlab tools for reading netcdf became available (i.e., the command before ncread existed). So, like most people, I used snctools (e.g., command nc_varget). At some point, I converted TPXO2ROMS to native tools (ncread etc.), but somehow I missed that line. For me and anyone else with snctools in their path, it still worked.
What I do not understand is why Neel did not get an error message at line 486.
Cheers
John
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Sorry for the late reply Mr. John and Cate. I was dealing with my examinations.
I took your suggestion, implemented it by changing the lines mentioned by Mr. John and again ran my file. Now it's working fine.
Thanks a lot for your help.
Kind regards
-Neel
I took your suggestion, implemented it by changing the lines mentioned by Mr. John and again ran my file. Now it's working fine.
Thanks a lot for your help.
Kind regards
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Neel
that comes as a great relief - thanks for letting us know. Thanks again to Cate.
John
that comes as a great relief - thanks for letting us know. Thanks again to Cate.
John
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi John Luick,
It will be great, if you could suggest, what steps and/or scripts should I follow and/or use to generate tidal forcing data-sets using TPXO9-atlas-v4 netcdf bearing the following tidal components = "M2, S2, N2, K2, K1, O1, P1, Q1, Mf, Mm " for my ROMS Grid.
Thanks,
Subrat
Centre for Atmospheric and Oceanic Sciences,
IISc
It will be great, if you could suggest, what steps and/or scripts should I follow and/or use to generate tidal forcing data-sets using TPXO9-atlas-v4 netcdf bearing the following tidal components = "M2, S2, N2, K2, K1, O1, P1, Q1, Mf, Mm " for my ROMS Grid.
Thanks,
Subrat
Centre for Atmospheric and Oceanic Sciences,
IISc
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello Subrat,suburom wrote: ↑Mon Apr 12, 2021 12:44 pm Hi John Luick,
It will be great, if you could suggest, what steps and/or scripts should I follow and/or use to generate tidal forcing data-sets using TPXO9-atlas-v4 netcdf bearing the following tidal components = "M2, S2, N2, K2, K1, O1, P1, Q1, Mf, Mm " for my ROMS Grid.
Thanks,
Subrat
Centre for Atmospheric and Oceanic Sciences,
IISc
I suggest you to follow the Austides website https://austides.com/downloads/ to get the package which has the TPXO9 conversion package into ROMS input netcdf file. It works well with the atlas version (I am now using v4a) as well when I last used it. As for the tide components you will have the choice to chose which component you want in the script and work accordingly. Change the location of directory in your MATLAB script where your grid file is present in NETCDF format. Add it to your MATLAB path and also add a suitable location to have your output file. If you want to change the time indexing just switch to TPXO2ROMS_v5pt3script.m and change the tide start and reference and set your lengthsim variable by the number of days you need to calculate your forcing data.
Kind regards
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks Neel !
Actually I had already gone through Austides website " https://austides.com/downloads/ " and downloaded the latest package of "TPXO2ROMS_v5pt3_script.m ". I am little bit doubt about the use of TPXO9_atlas_v4.nc file in the script and also "TIDE_START" and "lengthSim=60" . If possible kindly make my confusion clear about the use of data file.
Thanks
Kind Regards
Subrat
Actually I had already gone through Austides website " https://austides.com/downloads/ " and downloaded the latest package of "TPXO2ROMS_v5pt3_script.m ". I am little bit doubt about the use of TPXO9_atlas_v4.nc file in the script and also "TIDE_START" and "lengthSim=60" . If possible kindly make my confusion clear about the use of data file.
Thanks
Kind Regards
Subrat
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear Subrat,
I am a bit confused about the part where you said " If possible kindly make my confusion clear about the use of data file." I am not sure about the term data file or anything special other than the grid which may be used for ROMS.
As for the atlas version, I used it 2 months back and it was working super fine atm.
Addressing to the usage of script, I am writing the changes you will need to make in the script:
Change the fnGrid to the location of your grid file along with the file. Make sure it's added to MATLAB path in the environment. As for fnOut set it to where you need your output and a suitable naming convention. I usually do not play with that:
As for the lengthSim variable, it is the number of days for which you may want to run the simulation. By default it's parameterised to 60 so that the run doesn't throw an error, you can change it to the number of days you want your data.
For the time reference and tide start part, I would use something like this:
P.S. my TIDE_START is set to 3016 which is essentially 4-April-2008 according to the gregorian calendar, for that I've my base as 2000-01-1. What I would suggest is that make a note of what timestamp is needed by you for ROMS initialization and change the parameters accordingly. By default, I believe it's set somewhat as 1900-1-1 but I may be a bit blurry with my memory about that.
Since you use tpxo_9_v4a_atlas that means you get the velocity and elevation file separately for each tidal component. When I was using, I was using only one component M2 so never bothered but since you would want to use quite some more, I suggest you loop through it in TPXO2ROMS_v5pt3.m:
If looping doesn't work I suggest you to contact Mr. John Luick and Cate on this thread as they are the expert in using TPXO2ROMS toolbox.
Kind regards
-Neel
I am a bit confused about the part where you said " If possible kindly make my confusion clear about the use of data file." I am not sure about the term data file or anything special other than the grid which may be used for ROMS.
As for the atlas version, I used it 2 months back and it was working super fine atm.
Addressing to the usage of script, I am writing the changes you will need to make in the script:
Change the fnGrid to the location of your grid file along with the file. Make sure it's added to MATLAB path in the environment. As for fnOut set it to where you need your output and a suitable naming convention. I usually do not play with that:
Code: Select all
fnGrid='C:\Users\aBc\Documents\MATLAB\TPXO\lombok_v3_grd_test.nc';
fnOut=['C:\Users\aBc\Documents\MATLAB\TPXO\lombok_v3_grd_test' datestr(t0,'ddmmmyyyy') '_v5.nc'];
ROMSnames={'M2' 'S2' 'N2' 'K2' 'K1' 'O1' 'P1' 'Q1' 'MM' 'MF' 'M4' 'MN4' 'MS4' '2N2' 'S1'};
For the time reference and tide start part, I would use something like this:
Code: Select all
TIDE_START=3016; %From ROMS *.in file (TIME_REF=-2)
t0=TIDE_START+datenum(2000,1,01); %TIDE_START in Matlab datenum
Since you use tpxo_9_v4a_atlas that means you get the velocity and elevation file separately for each tidal component. When I was using, I was using only one component M2 so never bothered but since you would want to use quite some more, I suggest you loop through it in TPXO2ROMS_v5pt3.m:
Code: Select all
TPXOfile.grid='grid_tpxo9_atlas_v4..nc';
TPXOfile.elev='h_m2_tpxo9_atlas_30_v4.nc';
TPXOfile.vel='u_m2_tpxo9_atlas_30_v4.nc';
Kind regards
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear Subrat,
you said you had problems with:
1. "the use of TPXO9_atlas_v4.nc file in the script and also "TIDE_START" and "lengthSim=60" ".
Have you downloaded TPXO9_atlas_v4.nc?
You need these three files:
'grid_tpxo9_atlas_v4.nc;
'h_m2_tpxo9_atlas_30_v4.nc'
'u_m2_tpxo9_atlas_30_v4.nc'
By the way, Neel wrote "grid_tpxo9_atlas_v4..nc". Notice the two dots. I assume that was a typo.
2. TIDE_START
That is a variable name in your ".in" file. Let us say you are modelling Pulicat Estuary. Then maybe your .in file might be called ocean_Pulicat.in. Let us say you want your model to start at 0000 hours on 14 April 2021. Then TIDE_START=datenum(2021,4,14)-datenum(19678,5,23). The second datenum may seem a strange and arbitrary choice. Let us proclaim the mystery of faith.
3. Set lengthsim to approximately how long your model run is likely to be. It doesn't need to be exact. It is not important. Tidal experts spend a lot of time counting the angels that can dance on the head of a pin. That is, worrying about millimetres in a process where the precision is usually in the inches.
you said you had problems with:
1. "the use of TPXO9_atlas_v4.nc file in the script and also "TIDE_START" and "lengthSim=60" ".
Have you downloaded TPXO9_atlas_v4.nc?
You need these three files:
'grid_tpxo9_atlas_v4.nc;
'h_m2_tpxo9_atlas_30_v4.nc'
'u_m2_tpxo9_atlas_30_v4.nc'
By the way, Neel wrote "grid_tpxo9_atlas_v4..nc". Notice the two dots. I assume that was a typo.
2. TIDE_START
That is a variable name in your ".in" file. Let us say you are modelling Pulicat Estuary. Then maybe your .in file might be called ocean_Pulicat.in. Let us say you want your model to start at 0000 hours on 14 April 2021. Then TIDE_START=datenum(2021,4,14)-datenum(19678,5,23). The second datenum may seem a strange and arbitrary choice. Let us proclaim the mystery of faith.
3. Set lengthsim to approximately how long your model run is likely to be. It doesn't need to be exact. It is not important. Tidal experts spend a lot of time counting the angels that can dance on the head of a pin. That is, worrying about millimetres in a process where the precision is usually in the inches.
Re: TPXO to ROMS EXPRESS (tide extraction software)
First of all I thanks Neel,
For providing the details about the use of TPXO9_atlas_v4.nc version 4 data sets. Right now I am looking into Dr. John Luick script for the extraction of tidal components.
Secondly I thanks Dr. Jon Luick for your well constructed matlab script,
I already received the OSU TPXO9 data sets along with TPXO9 grid file from Dr. Svetlana Erofeeva and Dr. Gary Egbert.
Some Queries:
1) Instead of using a single "m2" component, I need to understand how to use all 10 tidal components (i.e., M2, S2, N2, K2, K1, O1, P1, Q1, Mf, Mm) to generate a single Tidal_forcing.nc file for my ROMS Grid.
2) About TIDE_START!
In my roms_exp.in file i have mentioned "TIDE_START = 0.0d0".
I mean to say in my model, tidal component has to force/start sharp at 00:00:00 hours on 01 JAN 2000 (as per TIME_REF = 20000101.0d0 mention in the roms_exp.in).
Then in your script, should i mention "TIDE_START=datenum(2000,1,01)" instead of using "TIDE_START=datenum(2000,1,01)-datenum(19678,5,23)". Actually I do not understand about the reason behind the use of second datenum (i.e, -datenum(19678,5,23)). Is second datenum is really necessary ???
I am little bit confused about the use of " TIDE_START=datenum(2000,1,01)-datenum(19678,5,23) ". Should I go for this "TIDE_START=datenum(2000,1,01)" or "TIDE_START=datenum(2000,1,01)-datenum(19678,5,23)"?
3) The total duration of my model simulation is for 2 years (730 days). So i need to provide tidal component to force the model for 730 days.
If I am not wrong then I should mention this in your script "lengthSim=730".
Your suggestion definitely help me in clarifying my doubt
Thanks with
Kind Regards
Subrat
For providing the details about the use of TPXO9_atlas_v4.nc version 4 data sets. Right now I am looking into Dr. John Luick script for the extraction of tidal components.
Secondly I thanks Dr. Jon Luick for your well constructed matlab script,
I already received the OSU TPXO9 data sets along with TPXO9 grid file from Dr. Svetlana Erofeeva and Dr. Gary Egbert.
Some Queries:
1) Instead of using a single "m2" component, I need to understand how to use all 10 tidal components (i.e., M2, S2, N2, K2, K1, O1, P1, Q1, Mf, Mm) to generate a single Tidal_forcing.nc file for my ROMS Grid.
2) About TIDE_START!
In my roms_exp.in file i have mentioned "TIDE_START = 0.0d0".
I mean to say in my model, tidal component has to force/start sharp at 00:00:00 hours on 01 JAN 2000 (as per TIME_REF = 20000101.0d0 mention in the roms_exp.in).
Then in your script, should i mention "TIDE_START=datenum(2000,1,01)" instead of using "TIDE_START=datenum(2000,1,01)-datenum(19678,5,23)". Actually I do not understand about the reason behind the use of second datenum (i.e, -datenum(19678,5,23)). Is second datenum is really necessary ???
I am little bit confused about the use of " TIDE_START=datenum(2000,1,01)-datenum(19678,5,23) ". Should I go for this "TIDE_START=datenum(2000,1,01)" or "TIDE_START=datenum(2000,1,01)-datenum(19678,5,23)"?
3) The total duration of my model simulation is for 2 years (730 days). So i need to provide tidal component to force the model for 730 days.
If I am not wrong then I should mention this in your script "lengthSim=730".
Your suggestion definitely help me in clarifying my doubt
Thanks with
Kind Regards
Subrat
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear Subrat,
I apologize, Mr. Luick, the double dot was indeed a typo.
I believe you slightly misunderstood what Mr. John Luick was trying to say by the line " Let us say you want your model to start at 0000 hours on 14 April 2021. Then TIDE_START=datenum(2021,4,14)-datenum(19678,5,23). The second datenum may seem a strange and arbitrary choice. Let us proclaim the mystery of faith."
He meant to say that the Tide-Start variable is actually the offset in a number of days from a set base date in Gregorian calendar format. By default in TPXO2ROMS script, I believe it's set to (1968,5,23) which Mr. John might be using as a base date. Now you can keep it to anything. Let's say that you want to start tide simulation from 14,4,2021 and you kept your base date as 23,5,1968. In that case datenum(2021,4,14) - datenum(1968,5,23) will return an integer in MATLAB which is essentially a number of days between those two dates without adding that specific base date i.e 19319. This shall be assigned to TIDE_START variable. What I suggest you do is chose the date you want to start running your simulation from. Keep a base date fixed, then just assign the difference in number of days between those two days in your tide start variable. The second datenum might be more clear to you now
Yes, you may keep lengthSim variable as 730 days if your simulation is for 2 years but in that case, you may not be able to pick tide to start with a very recent one and you may need to select something from 2018 as your start.
Kind regards
-Neel
I apologize, Mr. Luick, the double dot was indeed a typo.
I believe you slightly misunderstood what Mr. John Luick was trying to say by the line " Let us say you want your model to start at 0000 hours on 14 April 2021. Then TIDE_START=datenum(2021,4,14)-datenum(19678,5,23). The second datenum may seem a strange and arbitrary choice. Let us proclaim the mystery of faith."
He meant to say that the Tide-Start variable is actually the offset in a number of days from a set base date in Gregorian calendar format. By default in TPXO2ROMS script, I believe it's set to (1968,5,23) which Mr. John might be using as a base date. Now you can keep it to anything. Let's say that you want to start tide simulation from 14,4,2021 and you kept your base date as 23,5,1968. In that case datenum(2021,4,14) - datenum(1968,5,23) will return an integer in MATLAB which is essentially a number of days between those two dates without adding that specific base date i.e 19319. This shall be assigned to TIDE_START variable. What I suggest you do is chose the date you want to start running your simulation from. Keep a base date fixed, then just assign the difference in number of days between those two days in your tide start variable. The second datenum might be more clear to you now
Yes, you may keep lengthSim variable as 730 days if your simulation is for 2 years but in that case, you may not be able to pick tide to start with a very recent one and you may need to select something from 2018 as your start.
Kind regards
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
Just a few little things to add to add to Neel's remarks.
If your model is a purely tidal model, there are not limits to when you start and finish, or how long the model goes for, but it will become a bit less accurate on a 18.6 year cycle called the nodal cycle. Particularly if the O1 component is quite large in your area, then it could be a slight issue (as O1 is the one most affected by the 18.6 year cycle).
Usually tides people limit their runs to one year because of that 18.6 year cycle. TPXO2ROMS adjusts the amplitude and phase of the harmonics to their values at the middle of the run (that is why it asks for lengthsim, so it can figure out when the middle of the run occurs).
A final note. I recommend you start with a two week run. Get it running. Don't worry about getting TIDE_START right for that. It will still run even if TIDE_START is way off. Once you have the joy and satisfaction of seeing it run, then go back and fiddle with TIDE_START etc., and run again for two weeks. Check the water levels against a tide gauge. If it looks good for two weeks, chances are it will look good for a year.
If your model is a purely tidal model, there are not limits to when you start and finish, or how long the model goes for, but it will become a bit less accurate on a 18.6 year cycle called the nodal cycle. Particularly if the O1 component is quite large in your area, then it could be a slight issue (as O1 is the one most affected by the 18.6 year cycle).
Usually tides people limit their runs to one year because of that 18.6 year cycle. TPXO2ROMS adjusts the amplitude and phase of the harmonics to their values at the middle of the run (that is why it asks for lengthsim, so it can figure out when the middle of the run occurs).
A final note. I recommend you start with a two week run. Get it running. Don't worry about getting TIDE_START right for that. It will still run even if TIDE_START is way off. Once you have the joy and satisfaction of seeing it run, then go back and fiddle with TIDE_START etc., and run again for two weeks. Check the water levels against a tide gauge. If it looks good for two weeks, chances are it will look good for a year.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thank You Sir (Dr. John Luick),johnluick wrote: ↑Thu Apr 15, 2021 8:53 am Just a few little things to add to add to Neel's remarks.
If your model is a purely tidal model, there are not limits to when you start and finish, or how long the model goes for, but it will become a bit less accurate on a 18.6 year cycle called the nodal cycle. Particularly if the O1 component is quite large in your area, then it could be a slight issue (as O1 is the one most affected by the 18.6 year cycle).
Usually tides people limit their runs to one year because of that 18.6 year cycle. TPXO2ROMS adjusts the amplitude and phase of the harmonics to their values at the middle of the run (that is why it asks for lengthsim, so it can figure out when the middle of the run occurs).
A final note. I recommend you start with a two week run. Get it running. Don't worry about getting TIDE_START right for that. It will still run even if TIDE_START is way off. Once you have the joy and satisfaction of seeing it run, then go back and fiddle with TIDE_START etc., and run again for two weeks. Check the water levels against a tide gauge. If it looks good for two weeks, chances are it will look good for a year.
For giving this technical details about the TIDE_START. Now my confusion about the tide_start is clear.
From,
Subrat
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello Neel!neelbasak08 wrote: ↑Wed Feb 17, 2021 3:46 pm Sorry for the late reply Mr. John and Cate. I was dealing with my examinations.
I took your suggestion, implemented it by changing the lines mentioned by Mr. John and again ran my file. Now it's working fine.
Thanks a lot for your help.
Kind regards
-Neel
May I know what changes you have made in John's script so that your issues have been solved? Actually, I am also getting a similar kind of error as you have faced earlier in your study region. If possible, may I have a look at your modified script so that it will be easy to understand where I am doing a mistake?
Thanks
With Best Regrds
Subrat
- neelbasak08
- Posts: 99
- Joined: Wed Dec 09, 2020 3:58 pm
- Location: Thapar Institute of Engineering and Technology, Patiala, PN, India
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello Subrat,
I might suggest you visit post number 79 in this same thread. It has the lines that were missing in an earlier version of TPXO2ROMS. When I added those lines, it showed no error and generated my files successfully. Actually, the earlier version as far as I can recall didn't use the native netcdf in MATLAB to read the same attributes. But I very much believe now it's no more an issue as Mr. John Luick has very generously updated the package and added necessary changes. I have also used the latest TPXO2ROMS script and it works just as fine as the previous one after adding those lines.
Is that an issue with your MATLAB? You might be using an older version compared to 2013. Because I remember I had issues with the 2012 version as my ncvarget location was troubling me. But since 2019 uses native nc tools it's no more an issue. If your error is pertaining to the same CMP variable as I had then you should debug the code in MATLAB and maybe post output in the forum. It'll be more clear.
Anyways adding these lines as Mr. John and Cate pointed out accurately, did my job:
Kind regards
-Neel
I might suggest you visit post number 79 in this same thread. It has the lines that were missing in an earlier version of TPXO2ROMS. When I added those lines, it showed no error and generated my files successfully. Actually, the earlier version as far as I can recall didn't use the native netcdf in MATLAB to read the same attributes. But I very much believe now it's no more an issue as Mr. John Luick has very generously updated the package and added necessary changes. I have also used the latest TPXO2ROMS script and it works just as fine as the previous one after adding those lines.
Is that an issue with your MATLAB? You might be using an older version compared to 2013. Because I remember I had issues with the 2012 version as my ncvarget location was troubling me. But since 2019 uses native nc tools it's no more an issue. If your error is pertaining to the same CMP variable as I had then you should debug the code in MATLAB and maybe post output in the forum. It'll be more clear.
Anyways adding these lines as Mr. John and Cate pointed out accurately, did my job:
Code: Select all
%Line 486 must be changed to%
harmonicNames=upper(ncread(TPXOfile.elev,'con'));
harmonicNames=permute(harmonicNames,[2,1]);
-Neel
Re: TPXO to ROMS EXPRESS (tide extraction software)
neelbasak08 wrote: ↑Thu Apr 15, 2021 3:14 pm Hello Subrat,
I might suggest you visit post number 79 in this same thread. It has the lines that were missing in an earlier version of TPXO2ROMS. When I added those lines, it showed no error and generated my files successfully. Actually, the earlier version as far as I can recall didn't use the native netcdf in MATLAB to read the same attributes. But I very much believe now it's no more an issue as Mr. John Luick has very generously updated the package and added necessary changes. I have also used the latest TPXO2ROMS script and it works just as fine as the previous one after adding those lines.
Is that an issue with your MATLAB? You might be using an older version compared to 2013. Because I remember I had issues with the 2012 version as my ncvarget location was troubling me. But since 2019 uses native nc tools it's no more an issue. If your error is pertaining to the same CMP variable as I had then you should debug the code in MATLAB and maybe post output in the forum. It'll be more clear.
Anyways adding these lines as Mr. John and Cate pointed out accurately, did my job:Kind regardsCode: Select all
%Line 486 must be changed to% harmonicNames=upper(ncread(TPXOfile.elev,'con')); harmonicNames=permute(harmonicNames,[2,1]);
-Neel
Thanks Neel!
I will incorporate your suggestion
![Cool 8)](./images/smilies/icon_cool.gif)
As you said, I am not using the older MATLAB version ("Is that an issue with your MATLAB? You might be using an older version compared to 2013"). Actually, I am using Matlab 2018a (9.4.0) package for data pre- and post-processing work.
Finger crossed, let's hope it will work.
Thanks once again Neel!
With Best Regards
Subrat
Re: TPXO to ROMS EXPRESS (tide extraction software)
I have posted a new version of TPXO2ROMS Express at https://austides.com/downloads/. It is designed to read the latest OSU TPXO atlas (TPXO 9 v4). I tested the results against John Hunter's OTPS extraction software, as found at http://myroms.org/hunter/roms_tides/update/otps/, and the results are close enough (on the Espresso grid), although that software seems to have been static since TPXO 7 (2016), and would not work with more recent OSU atlases (come to think of it, there is probably more recent software on the OSU site). Both are simply Matlab functions with a wrapper. Both use Zhigang Xu's ap2ep.m to get variables like Cangle etc. for ROMS.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi John,
Thank you for maintaining this exceptionally useful code. I'm having a bit of a hard time successfully implementing tidal forcing in my model domain, which encompasses Bahia Almirante, near Bocas del Toro, Panama, and the surrounding coastal ocean. I've used TPXO9v4_ROMS.m to make my forcing file. The resulting time series of SSH doesn't match up well with the nearest (~100km) UHSLC water level estimate at Limon, Costa Rica. Measurement (in blue) is the Limon gauge, Model (in red) is ROMS output.
Full time series: Zoom: I'm giving the function the following info:
t0=datenum(2019,8,1,0,0,0);
ROMSnames={'M2','S2','N2','K2','K1','O1','P1','Q1','MM','MF','M4','MN4','MS4','2N2'};
fnGrid='almirante_grid.nc'; (attached to this post)
fnOut='almirante_tides_01Aug2019.nc';
nDays=365;
My TPXO model path is correct.
When I compare the TPXO extraction to constituents output from UTide (as applied on the Limon tide gage), there's agreement in the tidal amplitude, but differences in the phase lag for the most important constituents. When I apply UTide in this manner, the hourly time series start on 1 Aug 2019 and lasts for 365 days. Applying UTide to the ROMS output (hourly from 01 Aug 2019 until 4 Oct 2019) shows reasonable agreement in the amplitude for 2 of the top 4 constituents, but notably doesn't find P1 as a relevant constituent and badly misses the phasing of the M2 and O1 tides in the opposite direction of TPXO. I'm implementing tides in ROMS using all of the following options:
#define SSH_TIDES /* use if imposing tidal elevation */
#define UV_TIDES /* use if imposing tidal currents */
#define RAMP_TIDES /* use if ramping (over one day) tidal forcing, */
#define ADD_FSOBC /* use to add tidal elevation to processed OBC data */
#define ADD_M2OBC /* use to add tidal currents to processed OBC data */
My boundary conditions are from HYCOM GOFS 3.1 global output and do not include tidal forcing.
In my .in file, I have the following:
DSTART = 7152.0d0 ! days
TIDE_START = 0.0d0 ! days, tidal forcing was computed for 01 Aug 2020, SK 10/26/21
TIME_REF = 20000101.0d0 ! yyyymmdd.dd
This is a lot of text! The questions I have are as follows:
1.) Is my comparison of UTide to TPXO forcing valid w.r.t. reference times?
2.) If not, how can I make a more accurate comparison?
3.) My DSTART is set up for 01 Aug 2019. Is TIDE_START=0 correct for a TPXO file made using your code with the t0 above?
Thanks for your help.
Thank you for maintaining this exceptionally useful code. I'm having a bit of a hard time successfully implementing tidal forcing in my model domain, which encompasses Bahia Almirante, near Bocas del Toro, Panama, and the surrounding coastal ocean. I've used TPXO9v4_ROMS.m to make my forcing file. The resulting time series of SSH doesn't match up well with the nearest (~100km) UHSLC water level estimate at Limon, Costa Rica. Measurement (in blue) is the Limon gauge, Model (in red) is ROMS output.
Full time series: Zoom: I'm giving the function the following info:
t0=datenum(2019,8,1,0,0,0);
ROMSnames={'M2','S2','N2','K2','K1','O1','P1','Q1','MM','MF','M4','MN4','MS4','2N2'};
fnGrid='almirante_grid.nc'; (attached to this post)
fnOut='almirante_tides_01Aug2019.nc';
nDays=365;
My TPXO model path is correct.
When I compare the TPXO extraction to constituents output from UTide (as applied on the Limon tide gage), there's agreement in the tidal amplitude, but differences in the phase lag for the most important constituents. When I apply UTide in this manner, the hourly time series start on 1 Aug 2019 and lasts for 365 days. Applying UTide to the ROMS output (hourly from 01 Aug 2019 until 4 Oct 2019) shows reasonable agreement in the amplitude for 2 of the top 4 constituents, but notably doesn't find P1 as a relevant constituent and badly misses the phasing of the M2 and O1 tides in the opposite direction of TPXO. I'm implementing tides in ROMS using all of the following options:
#define SSH_TIDES /* use if imposing tidal elevation */
#define UV_TIDES /* use if imposing tidal currents */
#define RAMP_TIDES /* use if ramping (over one day) tidal forcing, */
#define ADD_FSOBC /* use to add tidal elevation to processed OBC data */
#define ADD_M2OBC /* use to add tidal currents to processed OBC data */
My boundary conditions are from HYCOM GOFS 3.1 global output and do not include tidal forcing.
In my .in file, I have the following:
DSTART = 7152.0d0 ! days
TIDE_START = 0.0d0 ! days, tidal forcing was computed for 01 Aug 2020, SK 10/26/21
TIME_REF = 20000101.0d0 ! yyyymmdd.dd
This is a lot of text! The questions I have are as follows:
1.) Is my comparison of UTide to TPXO forcing valid w.r.t. reference times?
2.) If not, how can I make a more accurate comparison?
3.) My DSTART is set up for 01 Aug 2019. Is TIDE_START=0 correct for a TPXO file made using your code with the t0 above?
Thanks for your help.
- Attachments
-
- almirante_grid.nc
- (42.04 MiB) Downloaded 1814 times
Re: TPXO to ROMS EXPRESS (tide extraction software)
@skastner:
My understanding is that TIDE_START is relative to TIME_REF, not DSTART.
There's multiple different ways to get the timing correct but here's how I personally like to set up my models:
My understanding is that TIDE_START is relative to TIME_REF, not DSTART.
There's multiple different ways to get the timing correct but here's how I personally like to set up my models:
Code: Select all
t0=datenum(2019,1,1,0,0,0); % for TPXO function
DSTART = 212.0d0 ! 01-Aug-2019
TIDE_START = 0.0d0
TIME_REF = 20190101.0d0 ! yyyymmdd.dd
Re: TPXO to ROMS EXPRESS (tide extraction software)
The safest approach to start, to avoid any confusion with these time coordinates, would be to use a TIME_REF that matches t0 in the TPXO function, and then TIDE_START and DSTART both = 0. Any phase mismatch then would point to something other than these switches.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi Sam,
thanks for the kind words. I think Kosa and John Wilkin's replies hold the key, but I will be interested to see the time series once you have adjusted the time coordinates. Also please let me know the lat and lon from which you have extracted the time series. I have extracted the TPXO data for the Almirante grid, and am interested to see how well I can match with the Limon data. You'd expect a reasonable match but slightly shifted for the 100 km distance. Also I can post a Matlab program that plots a time series for any point in the domain by doing a prediction from the TPXO harmonics at that point, if you are interested. Let me know if you want it.
John
thanks for the kind words. I think Kosa and John Wilkin's replies hold the key, but I will be interested to see the time series once you have adjusted the time coordinates. Also please let me know the lat and lon from which you have extracted the time series. I have extracted the TPXO data for the Almirante grid, and am interested to see how well I can match with the Limon data. You'd expect a reasonable match but slightly shifted for the 100 km distance. Also I can post a Matlab program that plots a time series for any point in the domain by doing a prediction from the TPXO harmonics at that point, if you are interested. Let me know if you want it.
John
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi John, John, and Kevin,
Thanks for your help. I have done what John Wilkin suggesting; setting DSTART and TIDE_START to 0 while making TIME_REF my desired start time (01 Aug 2019). The result using TPXO9 is below:
I extracted a location on the west side of the model domain, outside of the bay (82.5W, 9.7N). There's a significant phase discrepancy and a weird peak in the model. Aside from the peak, the tidal range looks ok.
I have had more luck using TPXO7, see below. A rogue minima, but looks better otherwise.
I'm attaching the Limon UHSLC data as a netcdf file to this post. John Luick, it would be great to have the code you mentioned--reconstructing the time series outside of ROMS seems like a logical next step.
Thanks,
Sam Kastner
Thanks for your help. I have done what John Wilkin suggesting; setting DSTART and TIDE_START to 0 while making TIME_REF my desired start time (01 Aug 2019). The result using TPXO9 is below:
I extracted a location on the west side of the model domain, outside of the bay (82.5W, 9.7N). There's a significant phase discrepancy and a weird peak in the model. Aside from the peak, the tidal range looks ok.
I have had more luck using TPXO7, see below. A rogue minima, but looks better otherwise.
I'm attaching the Limon UHSLC data as a netcdf file to this post. John Luick, it would be great to have the code you mentioned--reconstructing the time series outside of ROMS seems like a logical next step.
Thanks,
Sam Kastner
- Attachments
-
- limon_uhslc.nc
- (161.58 KiB) Downloaded 1705 times
Re: TPXO to ROMS EXPRESS (tide extraction software)
Just to be sure I understand what you are showing ...
The blue line is your data. The orange line is ROMS, and you have two cases where the tide harmonic boundary forcing is computed for TPXO7 and TPXO9 with the same Matlab code. Is this right?
Do the two orange lines overlay with a simple phase shift?
We wouldn't expact anything too radical in the TPXO7 and TPXO9 data. If you compare the ROMS boundary tides file harmonics, do you see very similar amplitudes but radically different phases? If phases are different, are they ALL different, or just some harmonics.
The blue line is your data. The orange line is ROMS, and you have two cases where the tide harmonic boundary forcing is computed for TPXO7 and TPXO9 with the same Matlab code. Is this right?
Do the two orange lines overlay with a simple phase shift?
We wouldn't expact anything too radical in the TPXO7 and TPXO9 data. If you compare the ROMS boundary tides file harmonics, do you see very similar amplitudes but radically different phases? If phases are different, are they ALL different, or just some harmonics.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: TPXO to ROMS EXPRESS (tide extraction software)
Yes, almost, except I'm using Eli Hunter's code for TPXO7 and John Luick's for TPXO9. Is this possibly the source of the mismatch--do the two codes handle time inputs differently? I've given them both the same date: August 1, 2019.
The lines do not overlap with a simple phase shift. I'm attaching a plot of the domain-wide mean phase for the top 4 tidal constituents (which comprise ~90% of variance in UTide analysis of the Limon gauge). There are significant differences between them. TPXO7 is shown in blue, TPXO9 in red, and the difference between them is shown in black on the bottom plot. Here's a similar plot to the top panel above, but showing amplitudes. These are more similar. I really appreciate the help.
The lines do not overlap with a simple phase shift. I'm attaching a plot of the domain-wide mean phase for the top 4 tidal constituents (which comprise ~90% of variance in UTide analysis of the Limon gauge). There are significant differences between them. TPXO7 is shown in blue, TPXO9 in red, and the difference between them is shown in black on the bottom plot. Here's a similar plot to the top panel above, but showing amplitudes. These are more similar. I really appreciate the help.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Oops, I wrote the below before noticing that you had already posted the plots of TPXO7 and TPXO9 harmonics. Well, maybe it will still be useful.
Sam, usually I find it more useful to compare harmonics rather than time series plots. I analysed the Limon water level data from UHSLC. Here are the main harmonics (name, amplitude, phase)...
Amplitude is in metres, and phase is in GMT to make it comparable to TPXO and ROMS phase.
Q1 0.012 224.351
O1 0.060 238.814
K1 0.102 239.774
N2 0.022 132.763
M2 0.085 178.156
S2 0.015 327.118
Extract the harmonics from the TPXO7 and TPXO9 data from a gridpoint near Limon, and see how they compare with the above.
The next step would be to analyse the ROMS output water levels from near Limon (good to have at least 30 or 40 days of hourly or more frequent model data, but even a week will do if it doesn't include the first day or two of model run, especially if it is a tides only run).
I decided not to post the Matlab functions because they could lead to confusion. I'm happy to help with the tide analysis if you post the data.
John L
Sam, usually I find it more useful to compare harmonics rather than time series plots. I analysed the Limon water level data from UHSLC. Here are the main harmonics (name, amplitude, phase)...
Amplitude is in metres, and phase is in GMT to make it comparable to TPXO and ROMS phase.
Q1 0.012 224.351
O1 0.060 238.814
K1 0.102 239.774
N2 0.022 132.763
M2 0.085 178.156
S2 0.015 327.118
Extract the harmonics from the TPXO7 and TPXO9 data from a gridpoint near Limon, and see how they compare with the above.
The next step would be to analyse the ROMS output water levels from near Limon (good to have at least 30 or 40 days of hourly or more frequent model data, but even a week will do if it doesn't include the first day or two of model run, especially if it is a tides only run).
I decided not to post the Matlab functions because they could lead to confusion. I'm happy to help with the tide analysis if you post the data.
John L
Re: TPXO to ROMS EXPRESS (tide extraction software)
Since the domain-wide mean phase isn't very illuminating, I encourage you to plot a map of the phases, and differences, to check that the offset is more or less constant everyone. That would be a clear indication of a time base problem. Likewise, mapping the amplitudes should show very little spatial difference in TPXO7 and TPXO9, but mapping the difference will test whether there is some mix-up in the interpolation step.
Can you run both TPXO7 and TPXO9 with John Luick's code, or different versions of the code? Again, the results should be very similar.
Can you run both TPXO7 and TPXO9 with John Luick's code, or different versions of the code? Again, the results should be very similar.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: TPXO to ROMS EXPRESS (tide extraction software)
Thanks for helping me troubleshoot this. To respond in turn:
The harmonics I get from 33 days of ROMS output w/TPXO9 (evaluated using t_tide, starting the analysis on 4 Aug 2019, after the tidal ramp up period):
Same units (amp in m, phase in GMT):
Q1: 0.0137 235.98
O1: 0.0679 349.88
K1: 0.1028 6.37
N2: 0.0283 295.76
M2: 0.0815 88.70
S2: 0.0209 251.69
The harmonics I get from 90 days of ROMS output w/TPXO7 (same evaluation, this file was created with the Hunter code):
Q1: 0.0112 196.90
O1: 0.0553 210.11
K1: 0.0757 243.13
N2: 0.0242 90.20
M2: 0.0832 148.32
S2: 0.0220 316.33
The domain doesn't include Limon, but these are from a point ~60 km away from Limon that is also significantly away from the domain's western boundary.
As to the domain wide maps of amplitude and phase difference between TPXO9 and TPXO7 for the top constituents, here they are.
Phase: Amplitude: It seems like a more-or-less constant phase offset (at least relative to the difference between the models), with the M2 amplitude offset being somewhat spatially variable. There's also a weird interpolation issue in Bahía Almirante, but that won't matter, as it's not along the edge, correct? Or am I misunderstanding how ROMS implements tides?
I haven't run both TPXO7 and TPXO9 with the same code yet, they take different versions of the atlas, and I don't have the netcdf files for 7 or the all-encompassing binary file for 9.
The harmonics I get from 33 days of ROMS output w/TPXO9 (evaluated using t_tide, starting the analysis on 4 Aug 2019, after the tidal ramp up period):
Same units (amp in m, phase in GMT):
Q1: 0.0137 235.98
O1: 0.0679 349.88
K1: 0.1028 6.37
N2: 0.0283 295.76
M2: 0.0815 88.70
S2: 0.0209 251.69
The harmonics I get from 90 days of ROMS output w/TPXO7 (same evaluation, this file was created with the Hunter code):
Q1: 0.0112 196.90
O1: 0.0553 210.11
K1: 0.0757 243.13
N2: 0.0242 90.20
M2: 0.0832 148.32
S2: 0.0220 316.33
The domain doesn't include Limon, but these are from a point ~60 km away from Limon that is also significantly away from the domain's western boundary.
As to the domain wide maps of amplitude and phase difference between TPXO9 and TPXO7 for the top constituents, here they are.
Phase: Amplitude: It seems like a more-or-less constant phase offset (at least relative to the difference between the models), with the M2 amplitude offset being somewhat spatially variable. There's also a weird interpolation issue in Bahía Almirante, but that won't matter, as it's not along the edge, correct? Or am I misunderstanding how ROMS implements tides?
I haven't run both TPXO7 and TPXO9 with the same code yet, they take different versions of the atlas, and I don't have the netcdf files for 7 or the all-encompassing binary file for 9.
Re: TPXO to ROMS EXPRESS (tide extraction software)
My suggestion was simply to compare the input tides file harmonics, but your analysis of a short ROMS model run suffices for the same purpose. Each harmonic shows a spatially uniform phase offset. To me, this implicates the processing of the time base date.
I think you need to look very closely as to whether you have configured your inputs correctly for John Luick's code.
I think you need to look very closely as to whether you have configured your inputs correctly for John Luick's code.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu
Re: TPXO to ROMS EXPRESS (tide extraction software)
Again, I think John W is on the right track there. I do have a couple of peripheral suggestions. First, the ranges on your y axes on the phase plots are way too big, and adding phase contours at (say) five degree intervals is usually helpful as you can use them tell the direction of propagation. You should choose a range that shows five or ten contour lines. The software can pick the range (based on the mean, max, min of phase in the region).
I don't know how useful it will be to you, but I have attached a Matlab script I wrote one time to compare a time series from TPXO (OTPS) predictions with that of the CMEMS ocean model (https://marine.copernicus.eu/sites/defa ... -MODEL.pdf). I had planned to add ROMS and ADCP data to the plot, but never got to it. I used Bay of Fundy because it has strong tides. I personally only use ROMS as a last resort (sorry ROMS guys!), like for grid resolution less than five km. Much quicker (and probably more accurate) to skip the middle man (ie the nested boundary), and just download CMEMS, then if you need to scope in, you can use CMEMS as the boundary condition (one version even contains tides). Here is a line of code I used to download the Bay of Fundy data from CMEMS:
python -m motuclient --user jluick --pwd <placeholder> --motu http://nrt.cmems-du.eu/motu-web/Motu --service-id GLOBAL_ANALYSIS_FORECAST_PHY_001_024-TDS --product-id global-analysis-forecast-phy-001-024-hourly-merged-uv --date-min "2021-1-1 00:30:00" --date-max "2021-2-1 23:30:00" --depth-min 0.49 --depth-max 0.51 --longitude-min -67.5 --longitude-max -63.3 --latitude-min 44 --latitude-max 46 --variable utide --variable vtide --out-dir . --out-name ../DATA/Bay_of_Fundy_test.nc
Obviously you have to paste it into a Visual Studio terminal window or Anaconda or whatever. And change <placeholder> to your CMEMS password!
You could use that method as a quick check on your ROMS results. (You can use u0 and v0 instead of utide and vtide if you want tide-free data, but then you may prefer to go to one of their reanalysis datasets for nontidal, nonrecent, data).
I don't know how useful it will be to you, but I have attached a Matlab script I wrote one time to compare a time series from TPXO (OTPS) predictions with that of the CMEMS ocean model (https://marine.copernicus.eu/sites/defa ... -MODEL.pdf). I had planned to add ROMS and ADCP data to the plot, but never got to it. I used Bay of Fundy because it has strong tides. I personally only use ROMS as a last resort (sorry ROMS guys!), like for grid resolution less than five km. Much quicker (and probably more accurate) to skip the middle man (ie the nested boundary), and just download CMEMS, then if you need to scope in, you can use CMEMS as the boundary condition (one version even contains tides). Here is a line of code I used to download the Bay of Fundy data from CMEMS:
python -m motuclient --user jluick --pwd <placeholder> --motu http://nrt.cmems-du.eu/motu-web/Motu --service-id GLOBAL_ANALYSIS_FORECAST_PHY_001_024-TDS --product-id global-analysis-forecast-phy-001-024-hourly-merged-uv --date-min "2021-1-1 00:30:00" --date-max "2021-2-1 23:30:00" --depth-min 0.49 --depth-max 0.51 --longitude-min -67.5 --longitude-max -63.3 --latitude-min 44 --latitude-max 46 --variable utide --variable vtide --out-dir . --out-name ../DATA/Bay_of_Fundy_test.nc
Obviously you have to paste it into a Visual Studio terminal window or Anaconda or whatever. And change <placeholder> to your CMEMS password!
You could use that method as a quick check on your ROMS results. (You can use u0 and v0 instead of utide and vtide if you want tide-free data, but then you may prefer to go to one of their reanalysis datasets for nontidal, nonrecent, data).
- Attachments
-
tidalcurrents_CMEMS_TPXO_ROMS_ADCP.m
- (4.78 KiB) Downloaded 1618 times
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hi John and John,
Thank you again for the advice. I've gone back and carefully checked the differences between Eli Hunter's TPXO7 code and John Luick's TPXO9 code, and the two do handle time slightly differently. If I understand correctly, John Luick's code, TPXO9v4_ROMS.m, uses the "t0" input given to it to make an equilibrium phase calculation (Vphase function call, line 104), and then uses the midpoint of the evaluation period (t0+ndays/2) to make a nodal correction calculation (TPXOnodalfactors call, line 108). Hunter's TPXO7 code, otpx2frc_v5.m, uses its input "base_date" to make the equilibrium phase calculation (t_vuf function call, line 115, though this isn't quite as well documented), while "pred_date" is used to make the nodal correction (t_vuf function call, line 116). So, to compare the files generated by the two codes 1:1, base_date should be the same as t0, while pred_date should be set to t0+ndays/2.
In the process of making sure I understood this, I think I stumbled upon an error in TPXO9vs_ROMS.m, John Luick. On lines 127-128, 132-133, and 137-138, shouldn't the indexing variable "n" instead be "k"? Assuming this is true, I have remade the plots from my previous post; namely, colorplots of the difference in phase and amplitude between the forcing file generated from John Luick's code used on TPXO9 and Hunter's code used on TPXO7. See below.
Amplitude: Phase (note that the color axes are not the same on all subplots): And here's just the phase of the TPXO9 file generated using John Luick's code (again, watch the color axes): This seems far more reasonable to me! I am going to start a ROMS run using the TPXO9 file generated with the above corrections; I'll update with how that goes for the sake of completeness.
Thank you once again for the help.
Thank you again for the advice. I've gone back and carefully checked the differences between Eli Hunter's TPXO7 code and John Luick's TPXO9 code, and the two do handle time slightly differently. If I understand correctly, John Luick's code, TPXO9v4_ROMS.m, uses the "t0" input given to it to make an equilibrium phase calculation (Vphase function call, line 104), and then uses the midpoint of the evaluation period (t0+ndays/2) to make a nodal correction calculation (TPXOnodalfactors call, line 108). Hunter's TPXO7 code, otpx2frc_v5.m, uses its input "base_date" to make the equilibrium phase calculation (t_vuf function call, line 115, though this isn't quite as well documented), while "pred_date" is used to make the nodal correction (t_vuf function call, line 116). So, to compare the files generated by the two codes 1:1, base_date should be the same as t0, while pred_date should be set to t0+ndays/2.
In the process of making sure I understood this, I think I stumbled upon an error in TPXO9vs_ROMS.m, John Luick. On lines 127-128, 132-133, and 137-138, shouldn't the indexing variable "n" instead be "k"? Assuming this is true, I have remade the plots from my previous post; namely, colorplots of the difference in phase and amplitude between the forcing file generated from John Luick's code used on TPXO9 and Hunter's code used on TPXO7. See below.
Amplitude: Phase (note that the color axes are not the same on all subplots): And here's just the phase of the TPXO9 file generated using John Luick's code (again, watch the color axes): This seems far more reasonable to me! I am going to start a ROMS run using the TPXO9 file generated with the above corrections; I'll update with how that goes for the sake of completeness.
Thank you once again for the help.
Re: TPXO to ROMS EXPRESS (tide extraction software)
Sam, first, regarding the nodal correction, yes, people normally choose a nodal correction at the middle of the simulation period. It is usually a small correction. In your area, K1 is dominant, and the nodal phase correction varies between 0 - 9 degrees over the 18.6 year nodal cycle, while the K1 amplitude correction varies between 0 and about 12 cm. Not sure where we are right now on the nodal cycle but it's easy enough to work out. I don't remember how Hunter defines the base date, but yes it should be 0000 hours on the first day of the simulation, same as my t0.
There is something very strange about the indexing problem you describe. In my version, there is no indexing variable n, only k, the looping variable. For TPXO9v4 I did have to adapt to the new (actually, back to previous) way in which OSU stores the TPXO data. I will look into it and post a new version v5 shortly. I was about to do that anyway because Svetlana Erofeeva has updated to a new version which has...
new minor constituents 2q1,j1,l2,m3,mu2,nu2,oo1;
p1 & s1 are fully updated;
- TPXO9_atlas_v5/netcdf now include s1 at 1/30 resolution.
Updated polar areas (ANT and ARC), patches TAS, SOI, AZR.
- TPXO9v5a/netcdf is combined of TPXO9 in deep ocean and averaged
TPXO9_atlas_v5 in coastal areas; includes all new minor constituents.
It sounds pretty good!
In posting the debugged code tomorrow, I will also have an update to TPXO v5.
PS I like your plots. What jumps out now is that the amplitude and phase of the major harmonics K1 and M2 do not vary rapidly along the coast, so that the Limon harmonics, which you say are 60 km out of the domain, should be pretty comparable to ROMS on the nearest boundary.
Cheers
John
There is something very strange about the indexing problem you describe. In my version, there is no indexing variable n, only k, the looping variable. For TPXO9v4 I did have to adapt to the new (actually, back to previous) way in which OSU stores the TPXO data. I will look into it and post a new version v5 shortly. I was about to do that anyway because Svetlana Erofeeva has updated to a new version which has...
new minor constituents 2q1,j1,l2,m3,mu2,nu2,oo1;
p1 & s1 are fully updated;
- TPXO9_atlas_v5/netcdf now include s1 at 1/30 resolution.
Updated polar areas (ANT and ARC), patches TAS, SOI, AZR.
- TPXO9v5a/netcdf is combined of TPXO9 in deep ocean and averaged
TPXO9_atlas_v5 in coastal areas; includes all new minor constituents.
It sounds pretty good!
In posting the debugged code tomorrow, I will also have an update to TPXO v5.
PS I like your plots. What jumps out now is that the amplitude and phase of the major harmonics K1 and M2 do not vary rapidly along the coast, so that the Limon harmonics, which you say are 60 km out of the domain, should be pretty comparable to ROMS on the nearest boundary.
Cheers
John
Re: TPXO to ROMS EXPRESS (tide extraction software)
Dear friends, anybody knows where I can find and download the TPXO2ROMS_v4pt1 file?
Thank you
Thank you
Re: TPXO to ROMS EXPRESS (tide extraction software)
Hello everyone, when I run the TPXO9v5_ROMS_script, it reported some errors. The functions or variables 'ellipses' and 'cj_map' are not recognized. I think there are some libraries I missed, could you please help me point them out? Thank you advanced!
And also, I wanna ask that if I set TIDE_START to 20133, should I set the TIDE_START to 20133 in .in file too?
Thank you for your kindly help! ![Very Happy :D](./images/smilies/icon_biggrin.gif)
Code: Select all
subplot(2,1,1)
z2a(maskR==0)=nan;
contourf(lonR,latR,z2a)
cj_map
clim([min(min(z2a)) max(max(z2a))])
colorbar
ttxt=['TPXO9v5_ROMS ' char(ROMSnames(NP(N))) ' Elevation amplitude (m)'];
title(ttxt,'Interpreter','none')
text(dtlon,dtlat,'No time dependence','HorizontalAlignment','center','fontweight','b','fontsize',sftextsize)
subplot(2,1,2)
z2p(maskR==0)=nan;
contourf(lonR,latR,z2p)
cj_map
ellipse(sfac*maskRE.*CmaxE,sfac*maskRE.*CminE,maskRE.*CangE,lonRE,latRE,Ecolor);
h=ellipse(sfac*sfmaj,sfac*sfmaj/2,0,sflon,sflat,Ecolor); %Scale ellipse
h.LineWidth=1.5;
sftxt=['Scale ellipse ' num2str(sfmaj) ' m/s'];
text(sflon,sflat_text,sftxt,'HorizontalAlignment','center','color',Ecolor,'fontweight','b','fontsize',sftextsize)
clim([min(min(z2p)) max(max(z2p))])
colorbar
ttxt=['TPXO9v5_ROMS ' char(ROMSnames(NP(N))) ' Elevation phase'];
title(ttxt,'Interpreter','none')
text(dtlon,dtlat,dtstr,'HorizontalAlignment','center','fontweight','b','fontsize',sftextsize)
print(gcf,'-dpng',fnPNG_Z);
Code: Select all
t0=datenum(2022,7,7);
TIDE_START=20133;
lengthSim=14; %estimated length of model run (not exact)
fnGrid='X:\ROMS\grid\yangjiang_0.3km.nc';
fnOut=['X:\ROMS\TidalForcing\frc_TPXO9v5_' num2str(TIDE_START) '.nc'];
fnPNG_Z=['X:\ROMS\TidalForcing\Graphics\TPXO9v5_ROMS_M2_Zamp_Zpha_' datestr(t0,'HHMM ddmmmyyyy') '.png'];
fnPNG_C1=['X:\ROMS\TidalForcing\Graphics\TPXO9v5_ROMS_M2_Cpha_Cang_' datestr(t0,'HHMM ddmmmyyyy') '.png'];
fnPNG_C2=['X:\ROMS\TidalForcing\Graphics\TPXO9v5_ROMS_M2_Cmin_Cmax_' datestr(t0,'HHMM ddmmmyyyy') '.png'];
TPXOpath='X:\tide\TPXO9_atlas_v5_nc\';
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Re: TPXO to ROMS EXPRESS (tide extraction software)
这个工具我也用了,发现并不好用,很多函数在较新版本里无法运行,需要一个一个改,
哪怕是成功跑出来潮汐数据,运行在roms上也会报错,我试了很多次,都是如此。。
报错的内容
MAIN: Abnormal termination: BLOWUP.
REASON: KEchar = NaN, PEchar = NaN
哪怕是成功跑出来潮汐数据,运行在roms上也会报错,我试了很多次,都是如此。。
报错的内容
MAIN: Abnormal termination: BLOWUP.
REASON: KEchar = NaN, PEchar = NaN