• Pierre Cazenave's avatar
    Create a new function whose job is to take an existing FVCOM model restart... · 05d2e399
    Pierre Cazenave authored
    Create a new function whose job is to take an existing FVCOM model restart file and change the temperature and salinity values for values extracted from an appropriate POLCOMS model result file.
    
    The POLCOMS data is read in as a 4D array (y, x, z, t) and is interpolated onto the FVCOM sigma layers. This provides the correct number of vertical levels which are then interpolated onto the FVCOM horizontal unstructured grid. This order is chosen because interpolating onto the horizontal grid first would dramatically increase the number of interpolations of the vertical which would be necessary. Initial development of the function revealed that the interpolation returns NaNs outside the POLCOMS domain: since it is likely the FVCOM domain is both higher resolution and more faithful to the coastline, a simple extrapolation is performed to remove all the NaNs (based on the nearest existing finite value to a given NaN location).
    
    Once the data have been interpolated (and extrapolated), an existing NetCDF restart file is opened and its contents replicated into a new NetCDF file (appended with _polcoms.nc). Only the "temp" and "salinity" variables are changed with the interpolated 3D arrays (we lose a dimension because the FVCOM grid is unstructured).
    05d2e399
replace_FVCOM_restart_vars.m 14.9 KB