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

Compare histograms of the relative effect of small scales #34

Open
paigem opened this issue Sep 30, 2022 · 3 comments
Open

Compare histograms of the relative effect of small scales #34

paigem opened this issue Sep 30, 2022 · 3 comments

Comments

@paigem
Copy link
Collaborator

paigem commented Sep 30, 2022

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:

  • Histogram of the time-averaged effect of small scales (i.e. take average first, then histogram)
  • Time average of the histogram of the effect of small scales computed at each time step (i.e. take histogram at each time step, then average)

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?

  • There is a difference between the two histogram methods, particularly in the ncar method.
  • The histograms are heavily favoring the positive values, indicating (as we mention in our results issue) that the small scales are working to reinforce the mean fields. However, there are more negative values that appear in these histograms, which suggests that the small-scales do not uniformly enhance the mean patterns. Given the minimal number of negative values, however, it is likely that these negative values stem mostly from these linear regions as shown in this snapshot of the relative small scale effect for ql:

image

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
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
Copy link
Collaborator

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
Copy link
Collaborator Author

paigem commented Sep 30, 2022

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
Copy link
Collaborator

jbusecke commented Oct 4, 2022

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'.

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

2 participants