![]() return lat, lon class WRFInterpolator(object): # Interpolates WRF atmospheric model data on 2D fields def _init_(self, function_space, atm_pressure_field, ncfile_pattern, init_date): self.atm_pressure_field = atm_pressure_field # object that interpolates forcing data from structured grid on the local mesh id_interpolator = NetCDFLatLonInterpolator2d(function_space, to_latlon) # reader object that can read fields from netCDF files, applies spatial interpolation self.reader = NetCDFSpatialInterpolator(id_interpolator, ) # object that can find previous/next time stamps in a collection of netCDF files self.timesearch_obj = NetCDFTimeSearch(ncfile_pattern, init_date, NetCDFTimeParser) # finally a linear intepolator class that performs linar interpolation in time self.interpolator = LinearTimeInterpolator(self.timesearch_obj, self.reader) def set_fields(self, time): # Evaluates forcing fields at the given time pressure = self.interpolator(time) self.atm_pressure_with_halos = pressure Usage. code-block:: python def to_latlon(x, y, positive_lon=False): # Converts mesh (x,y) points to coordinates used in the atm data lon, lat = coordsys_spcs.spcs2lonlat(x, y) if positive_lon and lon < 0.0: lon += 360. Simple example of an atmospheric pressure interpolator. """ Methods for interpolating data from structured data sets on Thetis fields.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |