Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update our analysis code to only smooth winds or tracers #39

Open
paigem opened this issue Oct 5, 2022 · 8 comments
Open

Update our analysis code to only smooth winds or tracers #39

paigem opened this issue Oct 5, 2022 · 8 comments

Comments

@paigem
Copy link
Collaborator

paigem commented Oct 5, 2022

To isolate the largest contributors to the small scale differences, we discussed smoothing only the winds or only the tracers. This may take some thought on how to implement efficiently.

This was based on discussions on Friday, Sep. 30th (notes here).

@jbusecke
Copy link
Collaborator

jbusecke commented Oct 6, 2022

I have thought more about this. I currently think that the 'cleanest' way of doing this would be to 'degrade' the effective resolution (while leaving the actual resolution unchanged) would be a two step process:

  1. Coarsen the data (either with a naive .coarsen or by conservative xesmf interpolation to e.g. a 2x2 grid)
  2. Linearly interpolate these values back to the initial grid using xesmf.

We could also consider a nearest neighbor interpolation in step 2, but I would be worried about the strong edges we would create with this.

@jbusecke
Copy link
Collaborator

Ok I might need some help from the gcm-filters pro users here:
I set up a basic regular filter which should respect land like this:

import gcm_filters
wet_mask = ds_oc_grid.wet
simple_filter = gcm_filters.Filter(
    filter_scale=40,
    dx_min=1,
    filter_shape=gcm_filters.FilterShape.TAPER,
    grid_type=gcm_filters.GridType.REGULAR_WITH_LAND,
    grid_vars={'wet_mask': wet_mask}
)

And then I am trying to filter the following field:
image

with

da_filtered = simple_filter.apply(ds_merged.surface_temp, dims=['yt_ocean', 'xt_ocean'])

This gives me a smoothed field as desired, but there are tons of artifacts near the coasts.

image

This is totally undesirable for our purposes, since this seems to influence the signal into the WBC. Am I making some obvious mistake here?

@rabernat
Copy link
Collaborator

Probably a dumb question, but are we sure that the wet mask is correct?

@jbusecke
Copy link
Collaborator

This is the wet mask (which looks ok to me):
image

Could it be that this behavior is caused by the large values (K not C)? If I removed a constant value (300) from the data and then smooth the effect seems to be much smaller:
image

@jbusecke
Copy link
Collaborator

Hmm upon further inspection there are a few data points that do not perfectly overlap with the map. Let me investigate a bit more...

@jbusecke
Copy link
Collaborator

Oh wow, that was it!
Rebuilding the mask from np.insnan() gives this result:
image

Much better! And a lesson learned about gcm-filters haha.

@jbusecke
Copy link
Collaborator

jbusecke commented Oct 26, 2022

I have worked a fair bit on the smoothing procedure over the past two days, and I think I have a satisfying solution for now:

As @paigem experienced in her other project, a filter scale of e.g. 10 grid boxes, does not at all produce smoothed fields that would resemble the amount of detail a 1 deg model would produce (eddies are still very much visible, see below). So in order to separate the mesoscale and smaller we need to use much larger filter_scales.
We do however want to avoid too large* filter scales too, since that could pick up larger 'regional' features which might hinder physical interpretability of the results.

To visually find the sweet-spot I have made some comparison plots with a range of filter scales:

image

The top left image is the raw model SST output. Below each row shows the smoothed output for a particular filter scale (see title) on the left, and the difference from the raw field on the right.

I think that filter_scale=50 is the sweet spot, where the eddies are not visible anymore in the smoothed field.

@ocean-transport/collab_team please let me know if you think different.

Also @TomNicholas mentioned that for a publication we might want to rerun our results with slightly larger/smaller filter scales to test the robustness of the results.

Here is the notebook to reproduce the results.

@dhruvbalwada
Copy link
Member

The general rule of thumb is that the resolution of the model is about 5times the grid size. So if dx=10km, then the smallest features resolved are roughly 50km in size. This is due to the intrinsic dissipation in the model.

It seems like a filter scale of 50 would be reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants