inos@bas_ac_uk
Member
Hello WACCM users,We came across an issue recently to do with extracting tidal information from WACCM. This was related to a misunderstanding on our part, which has now been resolved, but I will repeat the question and answer on here (slightly edited) for the benefit of other users who may have the same problem/question.The problem:Here is the problem I have found with the 12h and 24h wind components:For daily (instantaneous) data, for both zonal and meridional winds, both 12h and 24h sin components are exactly zero. The 12h and 24h cos components are precisely twice the value of the plain undecomposed zonal or meridional wind.Putting the above couple of sentences into equations using the variable names:2*U = U_12_COS = U_24_COSU_12_SIN = U_24_SIN = 02*V = V_12_COS = V_24_COSV_12_SIN = V_24_SIN = 0These equalities hold exactly at all lat-lon-altitude points.For the monthly average data there is not this problem. The cos and sin components are all nonzero and look sensible when compared with the undecomposed wind variables.I suspect the problem is that the cos and sin components are being calculated for the daily data using only one time point. It would be useful to know precisely how the frequency components are extracted to understand what is going wrong here.------------------------------------------------------------------------------------------------The answer from Dan Marsh:You would definitely not want to set the averaging flag to 'I' = instaneous value, but instead to 'A' = average over period between output (i.e., over a day in your case). These fields accumulate the fourier coefficients for 24 and 12 hours in *universal time* for a dynamical field at a particular grid location. So, U*SIN(UT=0) will always be zero. If you set the averaging flag to 'A' and do daily output, it will calculate 1/48 * ( U*SIN(UT=0) + U*SIN(UT=0.5) + U*SIN(UT=1.0) + .... + U*SIN(UT=23.5) ) since the model timestep is 30 minutes.Post run, you can do a fourier transform in longitude and extract migrating and non-migrating components.Here's IDL code I wrote to do that (m is the zonal wave number, use /semi for the semidiurnal tides): pro calc_tidal, file, var, a, p, lat, lev, m = m, semi=semi if keyword_set(semi) then period = '_12_' else period = '_24_' if not keyword_set(m) then m = 0 nc1 = ncdf_open(file) var1 = var+period ncdf_varget, nc1, var1+'COS', fcosncdf_varget, nc1, var1+'SIN', fsin ncdf_varget, nc1, 'lat', latncdf_varget, nc1, 'lon', lonncdf_varget, nc1, 'lev', lev ncdf_close, nc1 nx = n_elements(lon)if m gt nx-1 then return if m lt 0 then m1 = nx+m else m1 = m ff = fft(complex(fcos, fsin), dimension = 1) a = abs( ff(m1,*,*) )a = reform(a) p = atan( imaginary(ff(m1,*,*)), real_part(ff(m1,*,*)) ) if keyword_set(semi) then begin p = reform(p)*6./!pi endif else begin p = reform(p)*12./!pi endelse returnend