ocean-transport / scale-aware-air-sea

Repo for collaborative project on scale-aware air-sea fluxes
1 stars 0 forks source link

Boundary effects due to filtering #46

Closed jbusecke closed 1 year ago

jbusecke commented 1 year ago

We have seen some 'halo' effects around continents, which we did not see when using the coarsening approach. Presumably these are introduced due to the filtering with gcm-filters.

We discussed that approaching a coastline could lead to artificial anisotropy of the filter (since the across shore data is shortened significantly), but I think there might also be an issue with smoothing across e.g. Panama, small island in Oceania and the Caribbean.

I would like to find a more sound solution to this issue, and will post some examples later, but for now I have resorted to just 'growing' the landmask.

jbusecke commented 1 year ago

I have looked into this a bit further and identified at least one clear problem for now.

The temperature and velocity outputs do not have the same wetmask. This is expected due to the staggering of the grid, but our xgcm interpolation increases this effect quite a bit: image This is the interpolated zonal velocity image and the SST. Note the little islands for a good example.

Overall I think extending the nans this way is not a big deal. We probably do not want to analyse values that close to the coast anyway. BUT, these mismatching nan structures are NOT properly treated in aerobulk-python!

We currently assume that the SST provides the applicable mask for all fields (see here). This is problematic, since aerobulk-python in fact does compute 'something' even if the velocities are nan (presumably it pads these with 0?)

image

This shows the latent flux computed from the smoothed fields. That halo is very noticeable, and if this is smoothed again (for instance in the case of the 'partial smoothed' fields - only smoothing vel or tracers) this will probably be 'smeared' out quite far away from the coast due to our large filter scale.

I am looking into extending the mask in our notebook for now, but I wanted to ask a general question: Do you all think this should be taken care of on the aerobulk-python level? Performance will probably take a hit (but might be negligible compared to the aerobulk call), but it would ensure that users cannot actually produce nonsensical values. Given the fact that I overlooked this, I think it would be highly likely that this happens again and produces non-valid values. Let me know what you think @ocean-transport/collab_team

dhruvbalwada commented 1 year ago

Thanks for catching this @jbusecke, let's chat more in person about this tomorrow.

One question that comes to mind is, how do models handle these effects? Presumably, they are only computing heat fluxes at tracer points, and so are likely doing some sort xgcm style interpolation to pass to flux package.

jbusecke commented 1 year ago

I am pretty sure they will actually implement some physical boundary conditions like zero flux at those boundaries. Let me test if I can use 0 as fill value for them to get rid of the nans?

jbusecke commented 1 year ago

So I went ahead and filled the velocities with 0 before interpolation, and then adjusted the nans to match the sst after the interpolation. The results look a lot more promising (compared to the last plot above): image

I am currently processing these data out to the leap buckets and then will see if this has a positive effect on the long term maps. @dhruvbalwada Id be happy to chat more about this today. Ill be at LEAP after lunch (maybe before if this docs appointment does not take too long).

dhruvbalwada commented 1 year ago

I feel that you solved it!!!

jbusecke commented 1 year ago

I have reprocessed the data and this looks really promising!

Here is a short time average (30 days) of the small scale contribution with NO posterior masking! image (2)

jbusecke commented 1 year ago

I consider this solved. The relevant code to fix this (in CM2.6) is here