eliocamp / metR

Tools for Easier Analysis of Meteorological Fields

Home Page:https://eliocamp.github.io/metR/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

waveflux.r different lists for psi.dxy

WMueller11 opened this issue · comments

Hi Elio,

I try to get running the waveflux.R, however when my script reaches the point to calculate psi.dxy
"...psi.dxy = Derivate(psi.dx ~ latrad, cyclical = FALSE)[[1]]), by = lon]..."

it says:

Error in model.frame.default(terms(formula, lhs = lhs, rhs = rhs, data = data, :
invalid type (list) for variable 'psi.dx'

Seems like has to do with psi.dx and latrad have different lists (2d and 1d respectively) and not supported by the function "Derivate". (see below screenshot for the data.table). Any idea how to solve this?

Regards
Wolfgang

dt
lon lat lonrad latrad gh u.mean v.mean f
1: -60 20 -1.047198 0.3490659 12365 15.28999 -13.410004 2.487241e-05
2: -60 20 -1.047198 0.3490659 12351 22.34999 -12.460007 2.487241e-05
3: -60 20 -1.047198 0.3490659 12356 35.44000 -8.410004 2.487241e-05
4: -60 20 -1.047198 0.3490659 12373 36.56999 1.449997 2.487241e-05
5: -60 20 -1.047198 0.3490659 12398 28.81999 -19.460007 2.487241e-05
---
200381: 90 40 1.570796 0.6981317 11614 31.67000 -4.410004 4.674483e-05
200382: 90 40 1.570796 0.6981317 11619 45.30000 -6.309998 4.674483e-05
200383: 90 40 1.570796 0.6981317 11701 51.59000 -4.160004 4.674483e-05
200384: 90 40 1.570796 0.6981317 11682 42.59000 2.089996 4.674483e-05
200385: 90 40 1.570796 0.6981317 11570 38.23999 8.949997 4.674483e-05
psi
1: 4876916474
2: 4871394692
3: 4873366757
4: 4880071778
5: 4889932102
---
200381: 2437346120
200382: 2438395434
200383: 2455604181
200384: 2451616788
200385: 2428112159
psi.dx
1: -275698028, -40676758, 99432076, 189824872, 144628474, 13558919,...
2: -275698028, -40676758, 99432076, 189824872, 144628474, 13558919,...
3: -275698028, -40676758, 99432076, 189824872, 144628474, 13558919,...
4: -275698028, -40676758, 99432076, 189824872, 144628474, 13558919,...
5: -275698028, -40676758, 99432076, 189824872, 144628474, 13558919,...
---
200381: 480970022,-579568877,-622856179, 146695857, -24048501,-245294711,...
200382: 480970022,-579568877,-622856179, 146695857, -24048501,-245294711,...
200383: 480970022,-579568877,-622856179, 146695857, -24048501,-245294711,...
200384: 480970022,-579568877,-622856179, 146695857, -24048501,-245294711,...
200385: 480970022,-579568877,-622856179, 146695857, -24048501,-245294711,...
psi.dxx
1: 2071650286, 4298674344, 2641354115, 517912572,-2019859029,-2019859029,...

Hi, can you provide a minimal reproducible example of this issue?