Skip to content

Commit

Permalink
moved (kks,lls) computation from physics.py to var.py entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-chew committed May 13, 2024
1 parent 39ca7e4 commit 7305202
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
12 changes: 2 additions & 10 deletions src/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ def compute_uw_pmf(self, analysis, summed=True):
U = self.U
V = self.V

wlat = analysis.wlat
wlon = analysis.wlon

kks = analysis.kks * 2.0 * np.pi
lls = analysis.lls * 2.0 * np.pi

# if ((kks.ndim == 1) and (lls.ndim == 1)):
# print(True)
Expand All @@ -58,11 +53,8 @@ def compute_uw_pmf(self, analysis, summed=True):
# ampls = analysis.ampls
ampls = np.copy(analysis.ampls)

wla = wlat # * self.AE
wlo = wlon # * self.AE

kks = kks / wlo
lls = lls / wla
kks = analysis.kks
lls = analysis.lls

om = -kks * U - lls * V
omsq = om**2
Expand Down
19 changes: 12 additions & 7 deletions src/var.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,20 @@ def get_attrs(self, fobj, freqs):
self.kks = fobj.m_i / (fobj.Ni)
self.lls = fobj.m_j / (fobj.Nj)

self.kks, self.lls = np.meshgrid(self.kks, self.lls)
self.dk = np.diff(self.kks).mean()
self.dl = np.diff(self.lls).mean()

# self.kks = self.kks / self.kks.size
# self.lls = self.lls / self.lls.size
wla = self.wlat
wlo = self.wlon

kks = self.kks * 2.0 * np.pi
lls = self.lls * 2.0 * np.pi

kks = kks / wlo
lls = lls / wla

self.kks, self.lls = np.meshgrid(kks, lls)

# self.clat = ma.getdata(df.variables['clat'][:])
# clat_vertices = ma.getdata(df.variables['clat_vertices'][:])
# clon = ma.getdata(df.variables['clon'][:])
# clon_vertices = ma.getdata(df.variables['clon_vertices'][:])

def grid_kk_ll(self, fobj, dat):
"""
Expand Down

0 comments on commit 7305202

Please sign in to comment.