ocean-eddy-cpt / gcm-filters-paper

Manuscript on spatial filtering method
1 stars 0 forks source link

2D AVISO figures #16

Closed NoraLoose closed 3 years ago

NoraLoose commented 3 years ago

@jakesteinberg suggested to show a figure where the (2D) Laplacian filtering framework is applied to gridded AVISO data. We could aim for a 2x3 panel figure:

unfiltered AVISO -- Gaussian-filtered AVISO -- Taper-filtered AVISO unfiltered POP data -- Gaussian-filtered POP data -- Taper-filtered POP data

Jake and I discussed showing either SSH (anomaly) or velocity.

I started a notebook in #14, where we can consolidate model & obs data. @jakesteinberg, I'm assigning you to this issue (because I can't assign both of us).

NoraLoose commented 3 years ago

@jakesteinberg, re your question how the POP data is forced: The simulation uses CORE forcing, i.e., annually repeating forcing of a "normal year". @iangrooms, is the data in /glade/work/igrooms/current_data the time-mean of the first 5 days in January?

jakesteinberg commented 3 years ago

Thanks for starting this issue (and clarifying on model forcing). Here is what I wrote to try and make an AVISO equivalent plot like @NoraLoose has made using POP data. The AVISO surface velocities are on a 0.25 degree grid and filtered by a filtering factor is 5 (just as a starting point). Below is a figure of the output and link to the notebook. @NoraLoose, I can combine this with the notebook you started, but wanted to make sure it all works first. Also I compute the Laplacian using a function Ian helped me with a little while ago that is a bit different in construction than the one you're using. I'll work on combing the code with your notebook in a bit (might need to chat to figure out the best way to do so).

aviso_filtered_velocity

NoraLoose commented 3 years ago

@jakesteinberg, nice! Here is my attempt to do the same for the POP data:

KE_gulfstream_log

Here is the notebook. I filtered 0.1 degree --> 1 degree (i.e., filtering factor 10). You could choose a filtering factor of 4, so we both filter to 1 degree?

NoraLoose commented 3 years ago

I checked your Laplacian, and it does the same thing as mine if you apply it to dx=dy=1 (which you do). So you can just use yours! The only aspect where our methods differ is that you don't weight the velocities by grid area before filtering (and divide by the area afterwards). Or maybe I missed it? I think your results won't change much if you include the whole area-weighting thing, especially for such a small region where the local area element of a lat/lon grid doesn't vary much.

One more comment - not relevant for this figure but maybe of interest in general: If you use your Laplacian for a non-regular grid with varying dx (e.g., for filtering with fixed filter length), it won't give you the correct thing. The correct one would be the function Laplacian2D_FV in the module filter.py. I spent quite some time debugging the Laplacian, so just wanted to share this. :smile:

iangrooms commented 3 years ago

@jakesteinberg, re your question how the POP data is forced: The simulation uses CORE forcing, i.e., annually repeating forcing of a "normal year". @iangrooms, is the data in /glade/work/igrooms/current_data the time-mean of the first 5 days in January?

The POP simulation starts from climatology (WOCE), and then has 15 years of normal-year forcing as spin-up. After the spin up it switches to CORE interannual forcing using the years 1977-2009. It looks like the time stamp for the POP data set is 12375, which means it's the average of days 325-330 of the year 2009 from the CORE2 forcing. Since this is a forced run at high res I wouldn't expect the eddies from the simulation to be anything like those in the obs for the same time period, but at least that's how they match up.

jakesteinberg commented 3 years ago

Thanks for clarifying. I've amended my analysis to filter a 5-day average (days 325-300) from 2009. I understand that they shouldn't match up, but figured why not align the obs. and model data. @NoraLoose I adopted your Laplacian2D_FV (thanks for sharing) and am still applying dx=dy=1. This should now weight each element by appropriate area? Good to have to the function for future use if I want to filter to a fixed length scale. I also changed the filtering factor to equal 4 such that we both figure to 1 degree. Let me know how you think it best to combine notebooks if you still want to? I'm pulling the AVISO data from the pangeo database...if that makes it more complicated?

aviso_filtered_velocity

NoraLoose commented 3 years ago

I adopted your Laplacian2D_FV (thanks for sharing) and am still applying dx=dy=1. This should now weight each element by appropriate area?

No, multiplying by area has to be done manually before the filtering process (so before applying your function "Filter2d"). After filtering, you divide by area again. You can check out cell 16 in this notebook, to see an example.

The Laplacian2D_FV is just the correct finite volume version of the (finite-difference) Laplacian you used before. The 2 Laplacians are the same if you set dx=dy=1, but not for spatially varying dx. For spatially varying dx, your previous Laplacian doesn't compute the correct fluxes across the cell edges. (More details in this notebook if you are interested.)

Let me know how you think it best to combine notebooks if you still want to? I'm pulling the AVISO data from the pangeo database...if that makes it more complicated?

I am running my notebook on casper, because this is where the POP model output is. Otherwise it should be pretty straight-forward to combine the 2 notebooks into one plot? I can have a look tomorrow.

jakesteinberg commented 3 years ago

Ah sorry, I had missed that cell before, thanks. I think I fixed it now. In this repository is the same notebook, but I've also added an nc file of the raw velocities and ke computed after filtering. You could just plot the ke (total and filtered) in this file and/or run the code in the notebook after loading the raw velocities (in the same file). Happy to chat more/coordinate/reformat.

And I figured I might as well adopt the Laplacian2D_FV version if I'd like to have dx vary in the future.

aviso_filtered_velocity

NoraLoose commented 3 years ago

We'd like to have @jakesteinberg add plots of EKE for the Gaussian and taper filters to his 2D AVISO figure (#16), to show that the taper filter produces negative EKE. Possibly also use cartopy to make the land boundaries look nicer (cf this notebook). I would appreciate getting a notebook for this figure into the repo as well.

@jakesteinberg, to get EKE you can basically run this notebook on your AVISO data. The idea is to add 2 more panels to your 3-panel figure, something like:

POP2_EKE

jakesteinberg commented 3 years ago

sounds good! thanks for keeping at this! so did you imagine a 5 panel figure? Is there a 5 panel figure using model output that I could match it to? I can start on this in bit and should finish tomorrow. I'll also upload the relevant notebook if you want to tweak it for formatting.

iangrooms commented 3 years ago

Yes, we were imagining a 5-panel figure, probably 2 rows and 3 columns. I don't think we have any other 5-panel figures to match to, but in terms of formatting I think you could try to follow the very last cell in the notebook Nora linked to.

jakesteinberg commented 3 years ago

ok sounds good, thanks.

jakesteinberg commented 3 years ago

Here's an updated version of the figure...hopefully as you envision it. @NoraLoose I followed most of your procedure in the notebook you linked, but I am using an updated version of filterSpec which incorporates the last round of changes Ian made such that the filter scales are comparable. And I switched to cartopy, previously I hadn't added in any coastlines. The corresponding notebook is here. Happy to edit/revise as needed.

aviso_ke_mke_eke

iangrooms commented 3 years ago

Thanks @jakesteinberg! This looks good to me. We might need to revise later, but for now I'll add this version to the paper.

iangrooms commented 3 years ago

Do you mind if I copy your notebook into the gcm-filters-paper repo? I'd like to have it all in one place so we can link to it in the article.

jakesteinberg commented 3 years ago

sure! no problem. I wasn't sure of the best way to add it. It might need some further tweaking in that it calls a function outside this notebook.