Skip to content

Commit

Permalink
Added analysis.setup_obs_grid.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwfncar committed Jul 13, 2024
1 parent 1e02e30 commit b29eea2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/process_swath_data/process_modis_l2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
an.control = 'control_modis_l2.yaml'
an.read_control()

an.generate_obs_grid()
print(an.obs_grid)
an.setup_obs_grid()
# print(an.obs_grid)

for time_interval in an.time_intervals:

Expand Down
22 changes: 13 additions & 9 deletions melodies_monet/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ def __init__(self):
self.model_regridders = None
self.obs_grid = None
self.obs_edges = None
self.obs_gridded_data = None

def __repr__(self):
return (
Expand Down Expand Up @@ -825,15 +826,6 @@ def setup_regridders(self):
self.obs_regridders = regrid_util.setup_regridder(self.control_dict, config_group='obs')
self.model_regridders = regrid_util.setup_regridder(self.control_dict, config_group='model')

def generate_obs_grid(self):
from .util import grid_util
self.obs_grid, self.obs_edges = grid_util.generate_uniform_grid(
self.control_dict['obs_grid']['start_time'],
self.control_dict['obs_grid']['end_time'],
self.control_dict['obs_grid']['ntime'],
self.control_dict['obs_grid']['nlat'],
self.control_dict['obs_grid']['nlon'])

def open_models(self, time_interval=None,load_files=True):
"""Open all models listed in the input yaml file and create a :class:`model`
object for each of them, populating the :attr:`models` dict.
Expand Down Expand Up @@ -974,6 +966,18 @@ def open_obs(self, time_interval=None, load_files=True):
o.open_obs(time_interval=time_interval, control_dict=self.control_dict)
self.obs[o.label] = o

def setup_obs_grid(self):
from .util import grid_util
self.obs_grid, self.obs_edges = grid_util.generate_uniform_grid(
self.control_dict['obs_grid']['start_time'],
self.control_dict['obs_grid']['end_time'],
self.control_dict['obs_grid']['ntime'],
self.control_dict['obs_grid']['nlat'],
self.control_dict['obs_grid']['nlon'])

for obs in self.control_dict['obs']:
for var in self.control_dict['obs'][obs]['variables']:
print(obs, var)

def pair_data(self, time_interval=None):
"""Pair all observations and models in the analysis class
Expand Down

0 comments on commit b29eea2

Please sign in to comment.