depth
Re: depth
You can see how ROMS is doing it in set_depth.F:
There is similar code out there for Matlab and Python.
Code: Select all
cff_r=hc(ng)*(SCALARS(ng)%sc_r(k)-SCALARS(ng)%Cs_r(k))
cff1_r=SCALARS(ng)%Cs_r(k)
hwater=h(i,j)
z_r0=cff_r+cff1_r*hwater
z_r(i,j,k)=z_r0+Zt_avg1(i,j)*(1.0_r8+z_r0*hinv)
-
- Posts: 72
- Joined: Fri Jan 31, 2014 5:54 pm
- Location: Khoramshahr Marine Science and Technology Universi
Re: depth
Sorry, but i have used rnt_setdepth.m (which located in RNT/matlib/rnt subdirectory) and depths.m (which is in ROMS/MATLAB/utility) for computing depth at rho points. Results were different
Actually, i my aim is to extract u and v values in specific depth.if you have another recommend i become appreciate to receive it
many thanks in advance
Actually, i my aim is to extract u and v values in specific depth.if you have another recommend i become appreciate to receive it
many thanks in advance
Re: depth
Are you asking which of the Matlab routines is correct? The only way to know for sure is to compare with the ROMS code. Perhaps you can use the ROMS output that looks like this to compare to:
For getting depths at the u,v points, simply average the two nearest rho point depths.
Code: Select all
Vertical S-coordinate System, Grid 01:
level S-coord Cs-curve Z at hmin at hc half way at hmax
50 0.0000000 0.0000000 0.000 0.000 0.000 0.000
49 -0.0200000 -0.0000415 0.319 -2.505 -4.728 -5.038
48 -0.0400000 -0.0001667 0.638 -5.021 -9.686 -10.557
47 -0.0600000 -0.0003782 0.957 -7.547 -14.882 -16.571
:
2 -0.9600000 -0.9012040 14.456 -232.651 -2703.668 -5407.838
1 -0.9800000 -0.9531675 14.726 -241.646 -2851.406 -5711.170
0 -1.0000000 -1.0000000 15.000 -250.000 -2985.012 -5985.024
-
- Posts: 72
- Joined: Fri Jan 31, 2014 5:54 pm
- Location: Khoramshahr Marine Science and Technology Universi
Re: depth
Dear
actually, my first post was about that . I want to know how i can compute each layer depth by ROMS output .
would you please tell me that the correct way to compute depth (by ROMS output) is to multiplying each layer's S_coor (or CS_curve ) with h values which can be gotten from h matrix of grid file?
Best
pooran
actually, my first post was about that . I want to know how i can compute each layer depth by ROMS output .
would you please tell me that the correct way to compute depth (by ROMS output) is to multiplying each layer's S_coor (or CS_curve ) with h values which can be gotten from h matrix of grid file?
Best
pooran
Re: depth
Since it appears you are a Matlab user (you mention using rnt*.m routines in the past) there are Matlab routines on the myroms.org site that compute the z-coordinates.
If you don't want to download the entire set of Matlab routines from the repository, you can browse the code the same way you might browse the ROMS code itself and just grab what you need.
Go to the "trac" source code browser https://www.myroms.org/projects/src/browser and login with the same roms username/password you use to access the User Forum and the myroms.org svn source code. Once logged in you will see a link to the Matlab code tree.
Click on matlab, then Utility, and there you will find routine set_depth.m which calls stretching.m and these will compute the z-coordinates. You choose whether you get the rho points or w-points coordinates on output. You will find these routines probably call several other functions from this repository, so you might want to just grab everything.
These routines are kept consistent with the Vtransform and Vstretching options available in the myroms code. (It is possible that if you have a very old version of the RNT tools that not all vertical stretching options are supported).
If you don't want to download the entire set of Matlab routines from the repository, you can browse the code the same way you might browse the ROMS code itself and just grab what you need.
Go to the "trac" source code browser https://www.myroms.org/projects/src/browser and login with the same roms username/password you use to access the User Forum and the myroms.org svn source code. Once logged in you will see a link to the Matlab code tree.
Click on matlab, then Utility, and there you will find routine set_depth.m which calls stretching.m and these will compute the z-coordinates. You choose whether you get the rho points or w-points coordinates on output. You will find these routines probably call several other functions from this repository, so you might want to just grab everything.
These routines are kept consistent with the Vtransform and Vstretching options available in the myroms code. (It is possible that if you have a very old version of the RNT tools that not all vertical stretching options are supported).
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: depth
Hi Pooran,
I've used John Wilkin's tools to compute depth layers on ROMS' output. It has the roms_zslice.m function which can be very useful to you. I've just made a loop with that function and created a new file with the depths I wanted.
Hope it helps.
Arthur
I've used John Wilkin's tools to compute depth layers on ROMS' output. It has the roms_zslice.m function which can be very useful to you. I've just made a loop with that function and created a new file with the depths I wanted.
Hope it helps.
Arthur
-
- Posts: 72
- Joined: Fri Jan 31, 2014 5:54 pm
- Location: Khoramshahr Marine Science and Technology Universi
Re: depth
Dear
As you know by using set_depth.m, number of z levels will be same as number of sigma layers. In the other hand each sigma layer has thickness in vertical direction. So please tell me that computed z values for each layer are corresponded to maximum or mean depth in each sigma level.
Cheers
pooran
As you know by using set_depth.m, number of z levels will be same as number of sigma layers. In the other hand each sigma layer has thickness in vertical direction. So please tell me that computed z values for each layer are corresponded to maximum or mean depth in each sigma level.
Cheers
pooran
-
- Posts: 72
- Joined: Fri Jan 31, 2014 5:54 pm
- Location: Khoramshahr Marine Science and Technology Universi
Re: depth
Dear
i have used set_depth.m and then checked z values in bottom layer with amount of h which are in grid file. There were different. For example for one grid point which its maximum depth is grid file is 227.1217 m , computed z from surface to bottom are, -0.0927,-.2868,....,-10.1409,-44.2666,....,-166.8571,-205.3641, respectively. it means this routine gives -205.3641 m as maximum depth of this cell and also surface z is not equal to zero. also for cells with hmin values, amount of caluated z are not equal to fouth column of abow table With regard to:
if compartion with ROMS out put is in following way:
0*277.1217=0
-0.0312500* 277.1217=−8.660053125
-0.0625000* 277.1217=−17.32010625
:
:
-0.9375000* 277.1217=−259.80159375
-1* 277.1217=- 277.1217
please tell me why those values which calculated by set_depth, calculated from ROMS out put are different with h values is grid file? What is my fault? it makes me confused?
i become so grateful to receive your command
in my grid file
Vtransform=2;
Vstretching=4;
theta_s = 8.0d0
theta_b = 0.4d0
hc=6;
N=32;
i have used set_depth.m and then checked z values in bottom layer with amount of h which are in grid file. There were different. For example for one grid point which its maximum depth is grid file is 227.1217 m , computed z from surface to bottom are, -0.0927,-.2868,....,-10.1409,-44.2666,....,-166.8571,-205.3641, respectively. it means this routine gives -205.3641 m as maximum depth of this cell and also surface z is not equal to zero. also for cells with hmin values, amount of caluated z are not equal to fouth column of abow table With regard to:
Perhaps you can use the ROMS output that looks like this to compare to:
Code: Select all
level S-coord Cs-curve Z at hmin at hc half way at hmax
32 0.0000000 0.0000000 0.000 0.000 0.000 0.000
31 -0.0312500 -0.0000256 -0.101 -0.094 -0.198 -0.211
30 -0.0625000 -0.0001040 -0.202 -0.188 -0.421 -0.474
29 -0.0937500 -0.0002400 -0.304 -0.282 -0.672 -0.792
28 -0.1250000 -0.0004423 -0.406 -0.376 -0.956 -1.175
27 -0.1562500 -0.0007236 -0.508 -0.471 -1.278 -1.635
26 -0.1875000 -0.0011014 -0.610 -0.566 -1.647 -2.188
:
:
1 -0.9687500 -0.8117684 -6.190 -5.342 -400.420 -794.233
0 -1.0000000 -1.0000000 -7.000 -6.000 -492.123 -977.246
0*277.1217=0
-0.0312500* 277.1217=−8.660053125
-0.0625000* 277.1217=−17.32010625
:
:
-0.9375000* 277.1217=−259.80159375
-1* 277.1217=- 277.1217
please tell me why those values which calculated by set_depth, calculated from ROMS out put are different with h values is grid file? What is my fault? it makes me confused?
i become so grateful to receive your command
in my grid file
Vtransform=2;
Vstretching=4;
theta_s = 8.0d0
theta_b = 0.4d0
hc=6;
N=32;
Re: depth
The issue is explained in this depiction of the vertical coordinate definitions:
https://www.myroms.org/wiki/index.php/F ... l_grid.png
and in the background on the vertical discretization at
https://www.myroms.org/wiki/index.php/N ... retization
The "rho" points depths are the vertical center of the cells (or layers). The interfaces are at the "w" points. Hence there are N rho-points and N+1 w-points. The bottom of the bottom-most layer is z=-h, and therefore the z-center of the bottom-most layer is above this. Likewise, the top of the top-most layer is z=0 (actually z=zeta) so the z-center is below this.
https://www.myroms.org/wiki/index.php/F ... l_grid.png
and in the background on the vertical discretization at
https://www.myroms.org/wiki/index.php/N ... retization
The "rho" points depths are the vertical center of the cells (or layers). The interfaces are at the "w" points. Hence there are N rho-points and N+1 w-points. The bottom of the bottom-most layer is z=-h, and therefore the z-center of the bottom-most layer is above this. Likewise, the top of the top-most layer is z=0 (actually z=zeta) so the z-center is below this.
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