Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting the positions of global n,m,l indices #66

Open
ipelupessy opened this issue Nov 18, 2019 · 8 comments
Open

getting the positions of global n,m,l indices #66

ipelupessy opened this issue Nov 18, 2019 · 8 comments

Comments

@ipelupessy
Copy link
Contributor

what is the recommended way to get grid center positions from n,m,l from the c++ ocean class?

@erik808
Copy link
Collaborator

erik808 commented Nov 18, 2019

Not sure if I understand, do you mean returning an array index based n,m,l,i,j,k? That would be the FIND_ROW2 macro.

@ipelupessy
Copy link
Contributor Author

i mean, what is the position in lon/lat and depth for a given grid index..

@erik808
Copy link
Collaborator

erik808 commented Nov 19, 2019

I'm afraid a conversion like that is not in Ocean right now so you would have to infer it using member functions in TRIOS_Domain:


        double Hdim() const {return hdim;}
        //@}

        //@{ get physical bound of the global domain
        double Xmin() const {return xmin;}
        double Xmax() const {return xmax;}
        double Ymin() const {return ymin;}
        double Ymax() const {return ymax;}
        double Zmin() const {return zmin;}
        double Zmax() const {return zmax;}
        //@}

For a coordinate i it would be something like (xmin + i*dx)*180/pi .

@ipelupessy
Copy link
Contributor Author

that's ok..there is also no way to retrieve the depth levels? (these are not evenly spaced)

@erik808
Copy link
Collaborator

erik808 commented Nov 19, 2019

Sorry, no straightforward access to depth levels. But they follow from hdim, k, dz and qz:

do k = l,1,-1
    write(6,*) "    ", k, " ", dz*dfzT(k)*hdim
 enddo

dfzT gives the stretching for T locations: dfzT(k) = dfdz(ze(k),qz)
and

REAL FUNCTION dfdz(z,qz)
  implicit none
  ! INPUT/OUTPUT
  real z,qz
  ! LOCAL
  real tth,ch
  ch = cosh (qz * (z+1))
  tth = tanh (qz)
  IF (qz.gt.1.0) THEN
     dfdz = qz  / (tth * ch * ch)
  ELSE
     !      dfdz = 1.0
     dfdz = 1.0 + (1.-qz)*(1.-2.*z)
  ENDIF
  RETURN
END FUNCTION dfdz

Here only the (qz.gt.1.0) case is relevant.

@ipelupessy
Copy link
Contributor Author

ok, thanks( I already had that) - I think it would be nice to have direct (read) access; just to be sure of the values and also to have the bitwise exact values used in the code..its not super high priority at the moment though

@Sbte
Copy link
Member

Sbte commented Nov 19, 2019

I think it would still be nice to have an interface for this implemented in i-emic though, instead of coding it inside of osume. I'm not sure if you have your own i-emic fork that you're working on.

@ipelupessy
Copy link
Contributor Author

we don't use a seperate fork...& I agree!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants