pydda.initialization.make_initialization_from_iem_obs#
- pydda.initialization.make_initialization_from_iem_obs(Grid, station_obs, profile=None, power=2, vel_field=None)[source]#
Create an initial 3D wind field by inverse distance weighting (IDW) interpolation of Iowa Environmental Mesonet surface observations.
Surface station winds are used to compute horizontal anomalies relative to an optional sounding background. The anomalies are spread horizontally via IDW and added uniformly at every vertical level. When no sounding is supplied the background is zero (i.e. the IDW result stands alone).
- Parameters:
Grid (xarray.Dataset) – The PyDDA analysis grid. Must contain
x,y,z,point_x,point_y, andpoint_zcoordinate variables.station_obs (list of dict) – Surface observations, typically the output of
pydda.constraints.get_iem_obs(). Each dict must contain the keysx,y,z,u, andvin the Grid’s Cartesian coordinate system (metres).profile (pyart.core.HorizontalWindProfile or None) – Optional vertical sounding profile used as the background wind field. When provided the IDW step corrects only the horizontal anomalies (departure from the sounding) and the sounding provides the vertical structure. When
Nonethe background is zero and the surface IDW values are copied unchanged to every model level.power (float) – IDW distance-weighting exponent. Higher values give more weight to the nearest station. Typical values are 1 or 2 (default
2).vel_field (str or None) – Name of the radar velocity field in Grid used to determine the output grid shape.
Nonewill auto-detect viaGrid.attrs["first_grid_name"].
- Returns:
Grid (xarray.Dataset) – The input Grid with
u,v, andwfields added or replaced.wis set to zero everywhere because surface stations do not observe vertical motion.
Notes
The horizontal IDW anomaly is applied identically at every height level. This is equivalent to assuming that horizontal wind anomalies measured at the surface are representative of the full column (a reasonable first guess for a well-mixed boundary layer). If a sounding profile is given, that profile provides the height-varying mean, while the stations supply the mesoscale horizontal structure.
The function raises
ValueErrorif both station_obs is empty and profile isNone, since there is no information to build a field.Examples
>>> import pydda >>> Grid = pydda.io.read_grid(grid_file) >>> stn_obs = pydda.constraints.get_iem_obs(Grid) >>> Grid = pydda.initialization.make_initialization_from_iem_obs( ... Grid, stn_obs, profile=my_sounding ... )