Relative Content

Tag Archive for pythonindexinginterpolationpython-xarray

How to add a 2nd dimension and “altitude dependency” to Xarray Dataset variables that are currently only time dependent

I currently am working with atmospheric data that came from multiple files separated in time (time discontinuous). I loaded in the netCDF files using the xarray open_mfdataset function and combined the files “by_coords”. All of this data, however, is strictly time-dependent only when I open the Dataset. Provided is a snippet of what the data looks like when opened. The main variables I am concerned about here would be “pres” (pressure) and “tdry” (temperature). There are many other variables in this Dataset as well such as wind components, wind speed/direction, relative humidity, etc. My problem here is I want each of the data variables to also be dependent on the coordinate seen here as “gpsalt” or altitude/height. For example, only time is attached to each temperature value and I would want altitude to also be attached to the same temperature value with the respective correct altitude value.