xoceanmodel / xroms

Work with ROMS ocean model output with xarray
https://xroms.readthedocs.io/
MIT License
62 stars 39 forks source link

Calculation of dz and dz_w #25

Closed claudiofgcardoso closed 2 years ago

claudiofgcardoso commented 2 years ago

Hello,

While browsing through xroms code, I noticed a possible error in the calculation of 'dz':

    ds["dz"] = grid.diff(ds.z_w, "Z")
    ds["dz"].attrs = {
        "long_name": "vertical layer thickness on vertical RHO grid",
        "time": "ocean_time",
        "field": "dz, scalar, series",
        "units": "m",
    }´

    ds["dz_w"] = grid.diff(ds.z_rho, "Z", boundary="fill")
    ds["dz_w"].attrs = {
        "long_name": "vertical layer thickness on vertical W grid",
        "time": "ocean_time",
        "field": "dz_w, scalar, series",
        "units": "m",
    }

It seems that 'ds' is actually calculating dz in w points, and 'ds_w' is calculating dz in rho points.

Cheers, Cláudio

claudiofgcardoso commented 2 years ago

I realised that the usage of 's_w' for the calculation of 'dz' is correct and makes perfect sense. Sorry for the unnecessary issue!