UTide icon indicating copy to clipboard operation
UTide copied to clipboard

Possible to get U V amp and phase components from Utide

Open thopri opened this issue 2 years ago • 0 comments

Hello,

I am in the process of implementing a Tidal analysis program using Utide. However I need U/V component amplitudes and phases from the two dimension analysis rather than the ellipse parameters. Does Utide provide these parameters or will I need to calculate them myself?

I have the following code which I adapted from Utides code/manual but it doesn't seem to work (the phases are all tiny values)

            ap = np.hstack((station["coef"]["rf"].b[:station["coef"]["nNR"]], station["coef"]["rf"].b[2 * station["coef"]["nNR"]: 2 * station["coef"]["nNR"] + station["coef"]["nR"]]))
            i0 = 2 * station["coef"]["nNR"] + station["coef"]["nR"]
            am = np.hstack((station["coef"]["rf"].b[station["coef"]["nNR"]: 2 * station["coef"]["nNR"]],station["coef"]["rf"].b[i0: i0 + station["coef"]["nR"]]))
            Xu = np.real(ap + am)
            Yu = -np.imag(ap - am)
            Xv = np.imag(ap + am)
            Yv = np.real(ap - am)
            Au = np.sqrt(Xu ** 2 + Yu ** 2)
            Av = np.sqrt(Xv ** 2 + Yv ** 2)
            gU = np.arctan2(Yu, Xu)
            gV = np.arctan2(Yv, Xv)

The coef is stored in my own station dictionary hence all the station["coef"] references but I think I am using the correct values?

Any pointers would be appreciated

thopri avatar Apr 18 '24 08:04 thopri