ocean-transport / scale-aware-air-sea

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

Compare histograms of the relative effect of small scales #34

Open paigem opened 1 year ago

paigem commented 1 year ago

I'm making this issue to share the differences in histograms of the relative effect of small scales. These plots compare two methods of computing the histograms:

Latent heat

Screen Shot 2022-09-29 at 5 31 19 PM

Note: evaporation shows nearly identical patterns

Sensible heat

Screen Shot 2022-09-29 at 5 31 31 PM

What do these plots say?

So it appears that each snapshot of the relative effect of small scales is not entirely positive, but is mostly positive.


Below is the code to produce this figure, where ds_plot is the original dataset of results. The ds_mean is the time mean of the original dataset.

Code ``` python nx = len(algos) ny = 3 for var in ['ql', 'qh', 'evap']: fig, axarr = plt.subplots(ny, nx, figsize=[8*nx,3.5*ny]) for ai,algo in enumerate(algos): # Start by taking mean over all time steps ds_algo = ds_mean.sel(algo=algo) full = ds_algo[var] large_scale = ds_algo[var+'_large_scale'] small_scale = full-large_scale small_scale_relative = (small_scale/full*100) bins = np.linspace(-20,20,20) h_mean = histogram(small_scale_relative.rename('small_scale_relative'),bins=bins,dim=['xt_ocean','yt_ocean']) # Now compute histogram at each time point before averaging ds_algo = ds_plot.sel(algo=algo) full = ds_algo[var] large_scale = ds_algo[var+'_large_scale'] small_scale = full-large_scale small_scale_relative = (small_scale/full*100) bins = np.linspace(-20,20,20) h_each_time = histogram(small_scale_relative.rename('small_scale_relative'),bins=bins,dim=['xt_ocean','yt_ocean']) h_each_time_plot = h_each_time.mean('time').load() # ----- Make the plots ----- # Histogram of the time mean ax = axarr[0,ai] ax = h_mean.to_series().plot.bar(ax=ax) ax.set_xticks(np.arange(20),[]) ax.set_title('Histogram of the time mean',fontsize=16) ax.set_xlabel('') ax.set_ylabel(algo) #ax.set_ylim(0,6200) # Time mean of histograms from each time step ax = axarr[1,ai] ax = h_each_time_plot.to_series().plot.bar(ax=ax) ax.set_xticks(np.arange(20),[]) ax.set_title('Time mean of histograms at each time step',fontsize=16) ax.set_xlabel('') ax.set_ylabel(algo) #ax.set_ylim(0,6200) # Difference ax = axarr[2,ai] ax = (h_mean-h_each_time_plot).to_series().plot.bar(ax=ax) ax.set_xticks(np.arange(20), labels=['-18','-16','-14','-12','-10','-8','-6','-4','-2','0', '2', '4', '6', '8','10','12','14','16','18','']) ax.set_title('Hist. of time mean - Time mean of hist. at each time step',fontsize=16) ax.set_xlabel('') ax.set_ylabel(algo) fig.subplots_adjust(hspace=0.4) fig.suptitle(var) ```
jbusecke commented 1 year ago

This is awesome, @paigem. Thanks for making these. I wonder if all the events that compensate rather than enforce the large scale field are related to storm systems of the mid/high latitudes? From the screenshot above it seems like all the negative areas are polewards of ~35 N/S? It might be worth doing the histograms above for rough latitude bins (e.g. abs(lat)>40 and abs(lat)<40) to confirm this impression?

paigem commented 1 year ago

That's a great idea @jbusecke!

And good point, it's likely the storm systems that are creating the ~linear edges in the snapshot figure above. I wonder if that's something we want to look into more? E.g. how small scales affect storms on a short timescale compared to the longer averaged effects.

jbusecke commented 1 year ago

I think @rabernat s suggestion of creating a histogram only along the time, xt_ocean dimension is a very good one. We could then either show a heatmap to have a histogram per 'xt_ocean' row, or bin certain latitude bands to show 2-4 latitude 'bands'.