Open astrobokonon opened 5 years ago
Specifically, the issue is here:
Under the hood in pyresample@1.12.2 or greater, compute_optimal_bb_area()
calls _compute_uniform_shape()
and things quickly fall apart for me from there.
in the way I have things structured right now, I get a numpy.ndarray
AttributeError because there is no where()
method for the things I've passed in.
Still happening with pyresample==1.13.1 as of 20191004
2019-10-04 14:53:42,635 INFO Found the following files:
2019-10-04 14:53:42,635 INFO OR_ABI-L2-CMIPC-M6C13_G16_s20192772146244_e20192772149029_c20192772149122.nc
2019-10-04 14:53:42,635 INFO Making the plots...
2019-10-04 14:53:42,637 INFO Reading: ./outputs/goes//raws/20192762054025_C13.nc
2019-10-04 14:53:42,722 INFO 2.989587593880576
2019-10-04 14:53:42,722 INFO 3.5251001155878576
2019-10-04 14:53:42,733 ERROR Traceback (most recent call last):
2019-10-04 14:53:42,733 ERROR File "/home/rhamilton/miniconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
2019-10-04 14:53:42,733 ERROR "__main__", mod_spec)
2019-10-04 14:53:42,734 ERROR File "/home/rhamilton/miniconda3/lib/python3.6/runpy.py", line 85, in _run_code
2019-10-04 14:53:42,734 ERROR exec(code, run_globals)
2019-10-04 14:53:42,734 ERROR File "/home/rhamilton/miniconda3/lib/python3.6/site-packages/memory_profiler.py", line 1227, in <module>
2019-10-04 14:53:42,734 ERROR exec_with_profiler(script_filename, prof, args.backend, script_args)
2019-10-04 14:53:42,734 ERROR File "/home/rhamilton/miniconda3/lib/python3.6/site-packages/memory_profiler.py", line 1128, in exec_with_profiler
2019-10-04 14:53:42,734 ERROR exec(compile(f.read(), filename, 'exec'), ns, ns)
2019-10-04 14:53:42,734 ERROR File "looper_goes16aws.py", line 177, in <module>
2019-10-04 14:53:42,735 ERROR forceDown=forceDownloads, forceRegen=forceRegenPlot)
2019-10-04 14:53:42,735 ERROR File "looper_goes16aws.py", line 116, in main
2019-10-04 14:53:42,735 ERROR forceRegen=forceRegen)
2019-10-04 14:53:42,735 ERROR File "/home/rhamilton/Codes/LIG/NightShift/nightshift/goes/plot.py", line 258, in makePlots
2019-10-04 14:53:42,735 ERROR pCoeff=pCoeff)
2019-10-04 14:53:42,735 ERROR File "/home/rhamilton/Codes/LIG/NightShift/nightshift/goes/plot.py", line 122, in crop_image
2019-10-04 14:53:42,735 ERROR 'lat_2': clat})
2019-10-04 14:53:42,735 ERROR File "/home/rhamilton/miniconda3/lib/python3.6/site-packages/pyresample/geometry.py", line 741, in compute_optimal_bb_area
2019-10-04 14:53:42,735 ERROR height, width = self._compute_uniform_shape()
2019-10-04 14:53:42,735 ERROR File "/home/rhamilton/miniconda3/lib/python3.6/site-packages/pyresample/geometry.py", line 702, in _compute_uniform_shape
2019-10-04 14:53:42,736 ERROR leftlons = leftlons.where(leftlons.notnull(), drop=True)
2019-10-04 14:53:42,736 ERROR AttributeError
2019-10-04 14:53:42,736 ERROR :
2019-10-04 14:53:42,736 ERROR 'numpy.ndarray' object has no attribute 'where'
It looks like some kind soul did what I had been meaning to do, this was raised in an issue (https://github.com/pytroll/pyresample/issues/220) and there's an associated PR to fix it. I should test with pyresample@1.13.2!
Code works with pyresample 1.20.0 at least now. Still need to make the projections uniform.
pyresample 1.12.2 is a breaking change for the code as is, so I've temporarily pinned it at 1.12.1. This is primarily due to a change in the
pyresample.geometry.SwathDefinition.compute_optimal_bb_area
method, which now seems to expect a different numpy array arrangement than I've been doing in my cobbled-together version.One way around this is to compute/set the area explicitly, rather than letting pyresample try to figure out the optimal area itself. Instead of definining a swath, than computing the area, I could figure out the magic needed to just directly define the area and then just do the projection into that area.
I just need to find the time to actually sit down and do that. Once that's done, I could then guarantee that the plot areas for GOES and NEXRAD are the same; as it is right now, they're a little off.
Once that's done, I should be ok to unpin pyresample's version (or at least test against the new one).