lkilcommons/OvationPyme

Southern hemisphere output from flux estimator is wrong

Closed this issue · 4 comments

Calling FluxEstimator.get_flux_for_time(dt,hemi='S') does not return the southern hemisphere estimator.

Lines 419-424 I think are written incorrectly, but there's a comment just below it that is confusing. Not sure what is meant with that comment, but you can see that the output is exactly the same no matter how you switch 'hemi'. All that changes as the grid latitudes.

Thank you for catching this.

I've fixed the problem in get_flux_for_time. I've also added some new Jupyter notebooks which might be handy for plotting the model output. I used them to check my assumptions about how the coefficient files were laid out, which turned out to be wrong.

I looked at flux patterns produced for Northern and Southern hemispheres using a particular SeasonalFluxEstimator (which in turn reads a particular season's coefficients file), and it seems like the 'summer' coefficients file contains the northern hemisphere coefficients for Boreal Summer (roughly May-August) and the southern hemisphere coefficients for Austral Summer (roughly November-February). That is when the confusing comment was referring to, and I had misunderstood what it meant.

Perhaps I was wrong when I cited those lines, thanks for the clarification. However, calling get_flux_for_time with the hemisphere flag set to N and S results in returning exactly the same gridflux, which was my original concern. It is my understanding that ovation can provide flux for each hemisphere separately, and not a merged flux, right? Changing the 'hemi' flag only changes the grid_mlats, which maybe is not exactly the desired behavior..

My understanding is that combining the northern and southern data is the desired behavior. There were magnetic local time coverage issues with the DMSP data used to create the model and there's a coverage gap in the post-midnight sector. To minimize the impact of the gap, predictions are created for both hemispheres and then averaged for the final prediction. This is how it was done in the IDL code I translated to make OvationPyme, so I'm going to leave that as the default for now. However, I added an optional kwarg to turn it off (combine_N_and_S=False) in get_flux_for_time.
With the fix I was referring to in my previous comment, you should be able to get the correct Northern and Southern predictions using the notebooks. They often aren't very different, except for bad bins and coverage gaps.

So I think I figured out where I've been going wrong. You're correct that the desired behavior in that part of the routine is to merge the hemispheres to fix the bad bins/gaps/ etc, and to interpolate that post-midnight sector. I'm referring to creating a separate southern hemisphere prediction entirely. If you're using the same IDL source I am, look for the 'seasonalmodel.doc' file.

The model is used by calling n_or_s=3 (combines hemispheres). The returned precipitation map is valid for the day called in the northern hemisphere. If it is desired to get the southern hemisphere precipitation, it is necessary to call season_epoch again, this time with
south_day = ((real_day + 365/2) mod 366) where
real_day = actual day of the year (still use n_or_s=3).

Using this procedure, I can reproduce results published in a Martines-Bedenko, Sun and Geosphere 2018 paper where they publish a model prediction of both hemispheres separately. That paper uses some funny color scales, but that method can lead to some drastically asymmetric predictions between hemispheres at times, which is something I'm trying to investigate. Ultimatey, DMSP data would be best, but I haven't found any handy python snippets to grab imager data from DMSP.