Hello,
I am applying the Lagrangian filter to surface salinity from ROMS model output, but I am encountering unexpected negative salinity values after filtering. Since salinity should physically remain non-negative, this seems incorrect.
Details
Data: ROMS surface salinity (salt at top layer)
Grid: Curvilinear with vertical sigma coordinates
Method: Lagrangian filtering (e.g., following particles backward/forward in time and averaging)
Issue: After applying the filter, some grid points produce negative values, even though the original salinity field is strictly positive.
What I’ve checked
Original ROMS salinity has no negative values.
Interpolation step seems to introduce the negative values.
The issue persists even after using different interpolation schemes.
Questions
Why might the Lagrangian filter produce negative salinity values?
Is this expected due to numerical interpolation, or is there a known issue with applying the filter to tracer variables?
How can this be corrected?
Should I enforce positivity (e.g., salt = max(salt, 0))?
Is there a recommended interpolation method or setting to avoid such artifacts?
Are tracer variables not recommended for this filter?
Do you have an example demonstrating how to correctly apply the Lagrangian filter to tracer fields (e.g., salinity or temperature)?
Example code snippet
import filtering
from datetime import timedelta
import logging
logging.getLogger('parcels').setLevel(logging.ERROR)
for level_idx in range(39,40):
filenames = {"U": "/data/pisces/LOV20.0/ocean_his_001*.nc", "V": "/data/pisces/LOV20.0/ocean_his_001*.nc","T": "/data/pisces/LOV20.0/ocean_his_001*.nc", "S": "/data/pisces/LOV20.0/ocean_his_001*.nc"}
variables = {"U": "u", "V": "v","T":"temp","S":"salt"}
dimensions = {"lon": "lon_psi", "lat": "lat_psi","time": "ocean_time","depth":"s_rho"}
indices = {"depth": [level_idx]}
f = filtering.LagrangeFilter("./filltered_var/filtered_var_level_"+str(level_idx), filenames, variables, dimensions, sample_variables=["S"],indices=indices,mesh="spherical",c_grid=True,advection_dt=timedelta(minutes=60).total_seconds(),window_size=timedelta(minutes=750).total_seconds(),highpass_frequency=5e-5,minimum_window=5)
f.seed_subdomain(min_lon=-125.8, max_lon=-124.1, min_lat=46, max_lat=47, skip=1)
f()
Hello,
I am applying the Lagrangian filter to surface salinity from ROMS model output, but I am encountering unexpected negative salinity values after filtering. Since salinity should physically remain non-negative, this seems incorrect.
Details
Data: ROMS surface salinity (salt at top layer)
Grid: Curvilinear with vertical sigma coordinates
Method: Lagrangian filtering (e.g., following particles backward/forward in time and averaging)
Issue: After applying the filter, some grid points produce negative values, even though the original salinity field is strictly positive.
What I’ve checked
Original ROMS salinity has no negative values.
Interpolation step seems to introduce the negative values.
The issue persists even after using different interpolation schemes.
Questions
Why might the Lagrangian filter produce negative salinity values?
Is this expected due to numerical interpolation, or is there a known issue with applying the filter to tracer variables?
How can this be corrected?
Should I enforce positivity (e.g., salt = max(salt, 0))?
Is there a recommended interpolation method or setting to avoid such artifacts?
Are tracer variables not recommended for this filter?
Do you have an example demonstrating how to correctly apply the Lagrangian filter to tracer fields (e.g., salinity or temperature)?
Example code snippet