scripts.regridding.regrid_and_vert_interp ========================================= .. py:module:: scripts.regridding.regrid_and_vert_interp Functions --------- .. autoapisummary:: scripts.regridding.regrid_and_vert_interp.regrid_and_vert_interp scripts.regridding.regrid_and_vert_interp._regrid_and_interpolate_levs scripts.regridding.regrid_and_vert_interp.save_to_nc scripts.regridding.regrid_and_vert_interp.regrid_data Module Contents --------------- .. py:function:: regrid_and_vert_interp(adf) This funtion regrids the test cases to the same horizontal grid as the observations or baseline climatology. It then vertically interpolates the test case (and baseline case if need be) to match a default set of pressure levels, which are (in hPa): 1000, 925, 850, 700, 500, 400, 300, 250, 200, 150, 100, 70, 50, 30, 20, 10, 7, 5, 3, 2, 1 Currently any 3-D observations file needs to have equivalent pressure levels in order to work properly, although in the future it is hoped to enable the vertical interpolation of observations as well. Description of needed inputs from ADF: case_name -> Name of CAM case provided by "cam_case_name" input_climo_loc -> Location of CAM climo files provided by "cam_climo_loc" output_loc -> Location to write re-gridded CAM files, specified by "cam_regrid_loc" var_list -> List of CAM output variables provided by "diag_var_list" var_defaults -> Dict that has keys that are variable names and values that are plotting preferences/defaults. target_list -> List of target data sets CAM could be regridded to taget_loc -> Location of target files that CAM will be regridded to overwrite_regrid -> Logical to determine if already existing re-gridded files will be overwritten. Specified by "cam_overwrite_regrid" .. py:function:: _regrid_and_interpolate_levs(model_dataset, var_name, regrid_dataset=None, regrid_ofrac=False, **kwargs) Function that takes a variable from a model xarray dataset, regrids it to another dataset's lat/lon coordinates (if applicable), and then interpolates it vertically to a set of pre-defined pressure levels. ---------- model_dataset -> The xarray dataset which contains the model variable data var_name -> The name of the variable to be regridded/interpolated. Optional inputs: ps_file -> A NetCDF file containing already re-gridded surface pressure regrid_dataset -> The xarray dataset that contains the lat/lon grid that "var_name" will be regridded to. If not present then only the vertical interpolation will be done. kwargs -> Keyword arguments that contain paths to surface pressure and mid-level pressure files, which are necessary for certain types of vertical interpolation. This function returns a new xarray dataset that contains the regridded and/or vertically-interpolated model variable. .. py:function:: save_to_nc(tosave, outname, attrs=None, proc=None) Saves xarray variable to new netCDF file .. py:function:: regrid_data(fromthis, tothis, method=1) Regrid data using various different methods