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

Problems running geo2grid.sh on RadM1 imagery from 08Apr2024? #691

Open
jpnIII opened this issue Apr 11, 2024 · 18 comments · May be fixed by pytroll/pyresample#596
Open

Problems running geo2grid.sh on RadM1 imagery from 08Apr2024? #691

jpnIII opened this issue Apr 11, 2024 · 18 comments · May be fixed by pytroll/pyresample#596
Assignees
Labels

Comments

@jpnIII
Copy link

jpnIII commented Apr 11, 2024

Hi all -- I am having problems running geo2grid.sh on RadM1 sector GOES-16 ABI imagery from 08Apr2024 (099), trying to generate cimss_true_color and C03 imagery. I am just trying to get a C03 image now, since that is simpler than cimss_true_color. I am using Geo2Grid version 1.2.b. I am using ABI imagery from 19:00:27, and I know that all 16 bands exist for this date and time. I am using a center of (37.328,-89.777), which I also know is fine. My search radius is 1000. I am right in the middle of this mesoscale imagery, and should be able to use any search radius (?) and still get an image. Or so I think. The difficult thing is that I can get a nice cimss_true_color image using a resolution of (1000,-1000), size of (1600,1200), but then when I change to, for example, resolution = (1500,-1500), size = (2000,1500) I end up with a nonsense remapped image . The output says "SUCCESS", but the output image has problems. I have attached my output jpg (converted the tif from geo2grid.sh) file, as well as a png file with a map on it. Finally, I am trying to do this on imaginator.ssec.wisc.edu.

Thank you for your help!

Sincerely,

Jim

m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z
m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z

MY COMMANDLINE:

(make_geo2grid_files_with_paramfile16.scr)  (See script line # 6654) (At Thu Apr 11 05:38:27 UTC 2024) Execute:  export PYTROLL_CHUNK_SIZE="4096" ; time geo2grid.sh -r abi_l1b -w geotiff -p C03 -g mesoscale_m1 --grid-configs geo2grid_config_mesoscale_m1.yaml -f /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C01_G16_s20240991900279_e20240991900337_c20240991900372.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C02_G16_s20240991900279_e20240991900337_c20240991900364.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C03_G16_s20240991900279_e20240991900337_c20240991900386.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C04_G16_s20240991900279_e20240991900337_c20240991900368.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C05_G16_s20240991900279_e20240991900337_c20240991900380.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C06_G16_s20240991900279_e20240991900343_c20240991900383.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C07_G16_s20240991900279_e20240991900349_c20240991900376.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C08_G16_s20240991900279_e20240991900337_c20240991900389.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C09_G16_s20240991900279_e20240991900343_c20240991900381.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C10_G16_s20240991900279_e20240991900348_c20240991900394.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C11_G16_s20240991900279_e20240991900337_c20240991900377.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C12_G16_s20240991900279_e20240991900342_c20240991900370.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C13_G16_s20240991900279_e20240991900348_c20240991900398.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C14_G16_s20240991900279_e20240991900337_c20240991900391.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C15_G16_s20240991900279_e20240991900343_c20240991900388.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C16_G16_s20240991900279_e20240991900348_c20240991900385.nc --radius-of-influence 1000 --output-filename m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z.tif --num-workers 4 -vvvv

MY .yaml navigation file:

(make_geo2grid_files_with_paramfile16.scr) Following are all grid definitions within the file: geo2grid_config_mesoscale_m1.yaml:

mesoscale_m1:
  projection:
    proj: lcc
    lat_1: 37.328
    lat_0: 37.328
    lon_0: -89.777
    datum: WGS84
    units: m
    no_defs: null
    type: crs
  shape:
    height: 1500
    width: 2000
  center:
    x: -89.777
    y: 37.328
    units: degrees
  resolution:
    dx: 1500.0
    dy: 1500.0

MY LOGFILE:

[2024-04-11 05:38:29,063] : DEBUG    : abi_l1b_geotiff : _prepare_initial_logging : Starting script with arguments: -r abi_l1b -w geotiff -p C03 -g mesoscale_m1 --grid-configs geo2grid_config_mesoscale_m1.yaml -f /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C01_G16_s20240991900279_e20240991900337_c20240991900372.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C02_G16_s20240991900279_e20240991900337_c20240991900364.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C03_G16_s20240991900279_e20240991900337_c20240991900386.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C04_G16_s20240991900279_e20240991900337_c20240991900368.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C05_G16_s20240991900279_e20240991900337_c20240991900380.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C06_G16_s20240991900279_e20240991900343_c20240991900383.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C07_G16_s20240991900279_e20240991900349_c20240991900376.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C08_G16_s20240991900279_e20240991900337_c20240991900389.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C09_G16_s20240991900279_e20240991900343_c20240991900381.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C10_G16_s20240991900279_e20240991900348_c20240991900394.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C11_G16_s20240991900279_e20240991900337_c20240991900377.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C12_G16_s20240991900279_e20240991900342_c20240991900370.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C13_G16_s20240991900279_e20240991900348_c20240991900398.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C14_G16_s20240991900279_e20240991900337_c20240991900391.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C15_G16_s20240991900279_e20240991900343_c20240991900388.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C16_G16_s20240991900279_e20240991900348_c20240991900385.nc --radius-of-influence 1000 --output-filename m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z.tif --num-workers 4 -vvvv -vv
[2024-04-11 05:38:29,063] : INFO     : abi_l1b_geotiff : _run_processing : Sorting and reading input files...
[2024-04-11 05:38:29,063] : DEBUG    : abi_l1b_geotiff : _set_preferred_chunk_size : Using environment variable chunk size: 4096
[2024-04-11 05:38:29,070] : DEBUG    : satpy.readers.yaml_reader : load_yaml_configs : Reading ('/home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/readers/abi_l1b.yaml',)
[2024-04-11 05:38:29,092] : DEBUG    : satpy.readers.yaml_reader : create_filehandlers : Assigning to abi_l1b: ['/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C01_G16_s20240991900279_e20240991900337_c20240991900372.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C02_G16_s20240991900279_e20240991900337_c20240991900364.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C03_G16_s20240991900279_e20240991900337_c20240991900386.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C04_G16_s20240991900279_e20240991900337_c20240991900368.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C05_G16_s20240991900279_e20240991900337_c20240991900380.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C06_G16_s20240991900279_e20240991900343_c20240991900383.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C07_G16_s20240991900279_e20240991900349_c20240991900376.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C08_G16_s20240991900279_e20240991900337_c20240991900389.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C09_G16_s20240991900279_e20240991900343_c20240991900381.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C10_G16_s20240991900279_e20240991900348_c20240991900394.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C11_G16_s20240991900279_e20240991900337_c20240991900377.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C12_G16_s20240991900279_e20240991900342_c20240991900370.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C13_G16_s20240991900279_e20240991900348_c20240991900398.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C14_G16_s20240991900279_e20240991900337_c20240991900391.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C15_G16_s20240991900279_e20240991900343_c20240991900388.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C16_G16_s20240991900279_e20240991900348_c20240991900385.nc']
[2024-04-11 05:38:29,619] : PID 2457037 : DEBUG    : polar2grid.core.script_utils : rename_log_file : Log renamed from '/reimaginator/data/gops/cases/total_solar_eclipse_08apr2024/2024099/floater/additional_floater_work/abi_l1b_geotiff_fail.log' to 'abi_l1b_geotiff_20240408_190027.log'
[2024-04-11 05:38:29,619] : PID 2457037 : INFO     : abi_l1b_geotiff : _run_processing : Loading product metadata from files...
[2024-04-11 05:38:29,620] : PID 2457037 : DEBUG    : satpy.composites.config_loader : load_compositor_configs_for_sensor : Looking for composites config file abi.yaml
[2024-04-11 05:38:29,763] : PID 2457037 : DEBUG    : pyorbital.tlefile : _get_config_path : Path to the Pyorbital configuration (where e.g. platforms.txt is found): /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/pyorbital/etc
[2024-04-11 05:38:29,842] : PID 2457037 : DEBUG    : satpy.composites.config_loader : load_compositor_configs_for_sensor : Looking for composites config file visir.yaml
[2024-04-11 05:38:29,887] : PID 2457037 : DEBUG    : satpy.readers.abi_l1b : get_dataset : Reading in get_dataset C03.
[2024-04-11 05:38:29,981] : PID 2457037 : DEBUG    : polar2grid.resample._resample_scene : resample_scene : Products to preserve resolution for: set()
[2024-04-11 05:38:29,981] : PID 2457037 : DEBUG    : polar2grid.resample._resample_scene : resample_scene : Products to use new resolution for: {DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=())}
[2024-04-11 05:38:29,983] : PID 2457037 : DEBUG    : polar2grid.resample._resample_scene : _get_default_resampler : Setting default resampling to 'nearest' for grid 'mesoscale_m1'
[2024-04-11 05:38:29,983] : PID 2457037 : INFO     : polar2grid.resample._resample_scene : _filter_scene_with_grid_coverage : Checking products for sufficient output grid coverage (grid: 'mesoscale_m1')...
[2024-04-11 05:38:29,990] : PID 2457037 : DEBUG    : polar2grid.filters._base : filter_scene : Analyzing 'DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=())' for filtering...
[2024-04-11 05:38:29,990] : PID 2457037 : DEBUG    : polar2grid.filters.resample_coverage : _get_and_cache_coverage_fraction : Computing coverage fraction for ('GOES-16', 'abi')
[2024-04-11 05:38:30,061] : PID 2457037 : DEBUG    : polar2grid.filters.resample_coverage : _filter_data_array : Resampling found 24.57% coverage.
[2024-04-11 05:38:30,061] : PID 2457037 : INFO     : polar2grid.resample._resample_scene : _resample_scene_to_single_area : Resampling to 'mesoscale_m1' using 'nearest' resampling...
[2024-04-11 05:38:30,061] : PID 2457037 : DEBUG    : polar2grid.resample._resample_scene : _resample_scene_to_single_area : Resampling to 'mesoscale_m1' using resampler 'nearest' with {'cache_dir': None, 'radius_of_influence': 1000.0}
[2024-04-11 05:38:30,061] : PID 2457037 : DEBUG    : satpy.scene : _resampled_scene : Resampling DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=())
[2024-04-11 05:38:30,322] : PID 2457037 : DEBUG    : satpy.resample : precompute : Computing kd-tree parameters
[2024-04-11 05:38:30,356] : PID 2457037 : DEBUG    : satpy.resample : compute : Resampling None
[2024-04-11 05:38:30,364] : PID 2457037 : DEBUG    : polar2grid.utils.legacy_compat : apply_p2g_name_to_scene : Mapping Satpy ID to P2G name: DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=()) -> C03
[2024-04-11 05:38:30,365] : PID 2457037 : DEBUG    : satpy.writers : read_writer_config : Reading ['/home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/writers/geotiff.yaml']
[2024-04-11 05:38:30,584] : PID 2457037 : DEBUG    : satpy.writers : add_config_to_tree : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/enhancements/generic.yaml
[2024-04-11 05:38:30,712] : PID 2457037 : DEBUG    : satpy.writers : add_config_to_tree : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/etc/polar2grid/enhancements/generic.yaml
[2024-04-11 05:38:31,000] : PID 2457037 : DEBUG    : satpy.writers : add_config_to_tree : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/etc/polar2grid/enhancements/generic.yaml
[2024-04-11 05:38:31,026] : PID 2457037 : DEBUG    : satpy.writers : add_config_to_tree : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/enhancements/abi.yaml
[2024-04-11 05:38:31,049] : PID 2457037 : DEBUG    : satpy.writers : add_config_to_tree : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/etc/polar2grid/enhancements/abi.yaml
[2024-04-11 05:38:31,073] : PID 2457037 : DEBUG    : satpy.writers : add_config_to_tree : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/etc/polar2grid/enhancements/abi.yaml
[2024-04-11 05:38:31,073] : PID 2457037 : DEBUG    : satpy.writers : apply : Data for DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=()) will be enhanced with options:
        [{'name': 'linear_stretch', 'method': <function stretch at 0x7fdf1eec6200>, 'kwargs': {'stretch': 'crude', 'min_stretch': 0.0, 'max_stretch': 100.0}}, {'name': 'gamma', 'method': <function gamma at 0x7fdf1eec62a0>, 'kwargs': {'gamma': 2.0}}]
[2024-04-11 05:38:31,073] : PID 2457037 : DEBUG    : trollimage.xrimage : stretch : Applying stretch crude with parameters {'min_stretch': 0.0, 'max_stretch': 100.0}
[2024-04-11 05:38:31,075] : PID 2457037 : DEBUG    : trollimage.xrimage : gamma : Applying gamma 2.0
[2024-04-11 05:38:31,096] : PID 2457037 : DEBUG    : trollimage.xrimage : get_scaling_from_history : Can only get combine scaling from a list of linear scaling operations: 'scale'. Setting scale and offset to (NaN, NaN).
[2024-04-11 05:38:31,101] : PID 2457037 : INFO     : abi_l1b_geotiff : _run_processing : Computing products and saving data to writers...
[2024-04-11 05:38:32,725] : PID 2457037 : INFO     : abi_l1b_geotiff : _run_processing : SUCCESS

MY OUTPUT FILE:

/home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/utils.py:612: UserWarning: The PYTROLL_CHUNK_SIZE environment variable is pending deprecation. You can use the dask config setting `array.chunk-size` (or the DASK_ARRAY__CHUNK_SIZE environment variable) and set it to the square of the PYTROLL_CHUNK_SIZE instead.
  chunk_size = _get_pytroll_chunk_size()
DEBUG    : Starting script with arguments: -r abi_l1b -w geotiff -p C03 -g mesoscale_m1 --grid-configs geo2grid_config_mesoscale_m1.yaml -f /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C01_G16_s20240991900279_e20240991900337_c20240991900372.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C02_G16_s20240991900279_e20240991900337_c20240991900364.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C03_G16_s20240991900279_e20240991900337_c20240991900386.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C04_G16_s20240991900279_e20240991900337_c20240991900368.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C05_G16_s20240991900279_e20240991900337_c20240991900380.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C06_G16_s20240991900279_e20240991900343_c20240991900383.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C07_G16_s20240991900279_e20240991900349_c20240991900376.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C08_G16_s20240991900279_e20240991900337_c20240991900389.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C09_G16_s20240991900279_e20240991900343_c20240991900381.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C10_G16_s20240991900279_e20240991900348_c20240991900394.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C11_G16_s20240991900279_e20240991900337_c20240991900377.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C12_G16_s20240991900279_e20240991900342_c20240991900370.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C13_G16_s20240991900279_e20240991900348_c20240991900398.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C14_G16_s20240991900279_e20240991900337_c20240991900391.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C15_G16_s20240991900279_e20240991900343_c20240991900388.nc /arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C16_G16_s20240991900279_e20240991900348_c20240991900385.nc --radius-of-influence 1000 --output-filename m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z.tif --num-workers 4 -vvvv -vv
INFO     : Sorting and reading input files...
DEBUG    : Using environment variable chunk size: 4096
DEBUG    : Reading ('/home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/readers/abi_l1b.yaml',)
DEBUG    : Assigning to abi_l1b: ['/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C01_G16_s20240991900279_e20240991900337_c20240991900372.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C02_G16_s20240991900279_e20240991900337_c20240991900364.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C03_G16_s20240991900279_e20240991900337_c20240991900386.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C04_G16_s20240991900279_e20240991900337_c20240991900368.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C05_G16_s20240991900279_e20240991900337_c20240991900380.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C06_G16_s20240991900279_e20240991900343_c20240991900383.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C07_G16_s20240991900279_e20240991900349_c20240991900376.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C08_G16_s20240991900279_e20240991900337_c20240991900389.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C09_G16_s20240991900279_e20240991900343_c20240991900381.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C10_G16_s20240991900279_e20240991900348_c20240991900394.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C11_G16_s20240991900279_e20240991900337_c20240991900377.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C12_G16_s20240991900279_e20240991900342_c20240991900370.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C13_G16_s20240991900279_e20240991900348_c20240991900398.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C14_G16_s20240991900279_e20240991900337_c20240991900391.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C15_G16_s20240991900279_e20240991900343_c20240991900388.nc', '/arcdata/goes/grb/goes16/2024/2024_04_08_099/abi/L1b/RadM1/OR_ABI-L1b-RadM1-M6C16_G16_s20240991900279_e20240991900348_c20240991900385.nc']
DEBUG    : Log renamed from '/reimaginator/data/gops/cases/total_solar_eclipse_08apr2024/2024099/floater/additional_floater_work/abi_l1b_geotiff_fail.log' to 'abi_l1b_geotiff_20240408_190027.log'
INFO     : Loading product metadata from files...
DEBUG    : Looking for composites config file abi.yaml
DEBUG    : Path to the Pyorbital configuration (where e.g. platforms.txt is found): /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/pyorbital/etc
DEBUG    : Looking for composites config file visir.yaml
DEBUG    : Reading in get_dataset C03.
DEBUG    : Products to preserve resolution for: set()
DEBUG    : Products to use new resolution for: {DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=())}
DEBUG    : Setting default resampling to 'nearest' for grid 'mesoscale_m1'
INFO     : Checking products for sufficient output grid coverage (grid: 'mesoscale_m1')...
DEBUG    : Analyzing 'DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=())' for filtering...
DEBUG    : Computing coverage fraction for ('GOES-16', 'abi')
DEBUG    : Resampling found 24.57% coverage.
INFO     : Resampling to 'mesoscale_m1' using 'nearest' resampling...
DEBUG    : Resampling to 'mesoscale_m1' using resampler 'nearest' with {'cache_dir': None, 'radius_of_influence': 1000.0}
DEBUG    : Resampling DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=())
DEBUG    : Computing kd-tree parameters
DEBUG    : Resampling None
DEBUG    : Mapping Satpy ID to P2G name: DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=()) -> C03
DEBUG    : Reading ['/home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/writers/geotiff.yaml']
DEBUG    : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/enhancements/generic.yaml
DEBUG    : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/etc/polar2grid/enhancements/generic.yaml
DEBUG    : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/etc/polar2grid/enhancements/generic.yaml
DEBUG    : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/satpy/etc/enhancements/abi.yaml
DEBUG    : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/etc/polar2grid/enhancements/abi.yaml
DEBUG    : Adding enhancement configuration from file: /home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/etc/polar2grid/enhancements/abi.yaml
DEBUG    : Data for DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<1>, modifiers=()) will be enhanced with options:
        [{'name': 'linear_stretch', 'method': <function stretch at 0x7fdf1eec6200>, 'kwargs': {'stretch': 'crude', 'min_stretch': 0.0, 'max_stretch': 100.0}}, {'name': 'gamma', 'method': <function gamma at 0x7fdf1eec62a0>, 'kwargs': {'gamma': 2.0}}]
DEBUG    : Applying stretch crude with parameters {'min_stretch': 0.0, 'max_stretch': 100.0}
DEBUG    : Applying gamma 2.0
DEBUG    : Can only get combine scaling from a list of linear scaling operations: 'scale'. Setting scale and offset to (NaN, NaN).
INFO     : Computing products and saving data to writers...
/home/shared/bin/geo2grid_v_1_2_b/geo2grid-swbundle-20231006-171312/libexec/python_runtime/lib/python3.11/site-packages/dask/array/chunk.py:278: RuntimeWarning: invalid value encountered in cast
  return x.astype(astype_dtype, **kwargs)
INFO     : SUCCESS

real    0m5.10s
user    0m4.59s
sys     0m0.66s
@djhoese
Copy link
Member

djhoese commented Apr 11, 2024

Try increasing your radius to 5000 and see how that changes the results.

@jpnIII
Copy link
Author

jpnIII commented Apr 11, 2024

Thank you, Dave -- Please see my attached attempts with 5000 and 10000. No go. I am going to try to change my resolution/size parameters from: 1500 -1500 2000 1500 to: 1600 -1600 2000 1500

Thank you again, sir.

Jim

m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z_5000
m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z_10000

@jpnIII
Copy link
Author

jpnIII commented Apr 11, 2024

And here is my attempt with search radius = 5000, resolution/size parameters = 1600 -1600 2000 1500 I'm afraid this didn't work, either.
m1_C03_GOES-16_ABI_RadM1_C03_2024099_190027Z_5000_1600_-1600_2000_1500

@jpnIII
Copy link
Author

jpnIII commented Apr 11, 2024 via email

@djhoese
Copy link
Member

djhoese commented Apr 11, 2024

So good news is that I can reproduce this with your data files. The bad news is I don't have much of an idea what is going on. At first I thought it was something with the LCC projection and maybe your grid was on the edge of it, but this doesn't make sense since your coastlines are shown fine. I then played with difference sizes and I think I've determined that it has something to do with the upper extent of your grid. I did a resolution of 1500x1500 and size of 1170Hx2000W and it was a bad image. If I change the center from your original 37 to 36, the image is fine.

I'll have to think about this, but at this point I'm not really sure why this upper limit is such a problem. It is possibly going beyond the Earth disk of the GOES-16 projection, but it doesn't make sense to me why that's a problem.

@jpnIII
Copy link
Author

jpnIII commented Apr 11, 2024

Thank you for checking into this, Dave. BTW, I tried checking into PROJ.4 projections and found a "US_Lambert_Conformal_Conic" projection. The navigation .yaml file generated was a bit different that the default, so I gave it a go within geo2grid.sh. Still did not work
GOES16_BAND3_2024099_190027
.

FYI, attached is a GIF generated in McIDAS-X that shows the actual imagery coverage of the GOES-16 M1 sector image from 190027 UTC 08Apr2024 (099).

@jpnIII
Copy link
Author

jpnIII commented Apr 11, 2024 via email

@jpnIII
Copy link
Author

jpnIII commented Apr 12, 2024

Hi again, Dave -- I thought I'd try a previous version of Geo2Grid, so I tried version 1.1 (installed on my computer back in Dec. 2022). Perhaps the following output will help you out:

.
.
.
DEBUG : Warning: invalid value encountered in true_divide

DEBUG : Warning: invalid value encountered in true_divide

DEBUG : Warning: invalid value encountered in true_divide

WARNING : Resampling found -129405.02% of the output grid 'mesoscale_m1' covered. Will skip producing this product: C03
DEBUG : Unloading 'DataID(name='C03', wavelength=WavelengthRange(min=0.8455, central=0.865, max=0.8845, unit='µm'), resolution=1000, calibration=<calibration.reflectance>, modifiers=())' due to filtering.
WARNING : No products were found to overlap with 'mesoscale_m1' grid.
INFO : Computing products and saving data to writers...
WARNING : No product files produced given available valid data and resampling settings. This can happen if the writer detects that no valid output will be written or the input data does not overlap with the target grid.
INFO : SUCCESS

@djhoese
Copy link
Member

djhoese commented Apr 18, 2024

I've had time to look into this more and have narrowed it down. You/we are running into a long standing issue in satpy/pyresample related to a "reduce_data" option in resampling. Basically this functionality cuts off the parts of the input data that don't intersect with the output grid (AreaDefinition) to save processing time. Right now there is no way to disable this logic in Geo2Grid. For some reason, the intersection seems valid, but the resulting calculations are determining that the intersection only uses/needs 1 row of the input data. Obviously that isn't correct.

For my own record keeping as I debug this, the intersection is a box of:

# lons
[-99.32561454 -84.88516832 -83.0471571  -94.43288115]
# lats
[44.8036327  44.24231052 31.16295788 31.41858294]

This maps to the following X/Y coordinates in the geostationary projection:

# x
[-1743495.04056     -741486.39656     -741486.39656    -1743495.04055999]
# y
[4188396.13192001 4188396.13192001 3186387.48792001 3186387.48791999]

# ABI area extent (minx, miny, maxx, maxy)
(-1743495.04056, 3186387.48792, -741486.39656, 4188396.13192)

So the intersection of the input and output grid match the input data it seems, but perhaps some floating point precision is ruining it.

More debugging to come...

@djhoese
Copy link
Member

djhoese commented Apr 19, 2024

@mraspaud @pnuu are the satpy and pyresample devs who have run into this issue in the past. I'm going to dump some findings here for them to provide feedback if they so desire:

The array indices computed from the above x/y coordinates end up being things like -0.50000001 and -0.499999998 or some floating point nonsense like that. There is also the other side of that for the 1000x1000 pixel area where the maximum index is 999.5000001 and 999.499999 or something close to that. The point is that the masked_ints decorator added to AreaDefinition.get_array_indices_from_lonlat which rounds the indices to integers and then masks anything < 0 and >= self.width/height. With floating point precision issues and with area extents being a half pixel beyond the array index, I don't think this decorator masked_ints works for this logic. I added a little blip to the code:

diff --git a/pyresample/geometry.py b/pyresample/geometry.py
index 70e1c62..673886a 100644
--- a/pyresample/geometry.py
+++ b/pyresample/geometry.py
@@ -1447,10 +1447,13 @@ class _ProjectionDefinition(BaseDefinition):
 def masked_ints(func):
     """Return masked integer arrays when returning array indices."""
     @wraps(func)
-    def wrapper(self, xm, ym):
+    def wrapper(self, xm, ym, allow_half_pixels=False):
         is_scalar = np.isscalar(xm) and np.isscalar(ym)

         x__, y__ = func(self, xm, ym)
+        if not is_scalar and allow_half_pixels:
+            x__ = np.clip(x__, 0, self.width - 1)
+            y__ = np.clip(y__, 0, self.height - 1)
         x__ = np.round(x__).astype(int)
         y__ = np.round(y__).astype(int)

Then passed allow_half_pixels=True in pyresample/future/geometry.py line 57 in the get_area_slices method. I just did it this way because I didn't want to break anything. And in fact, this fixes my issue discovered here and gets me a full dataset. I'm not sure if this is something that needs to be considered for all masked_ints usage or just this area slices conditions. One more flexible option to my above hack would be to mask things that are outside the area array indices plus half a pixel plus some epsilon.

@jpnIII
Copy link
Author

jpnIII commented Apr 19, 2024 via email

@pnuu
Copy link

pnuu commented Apr 19, 2024

diff --git a/pyresample/geometry.py b/pyresample/geometry.py
index 70e1c62..673886a 100644
--- a/pyresample/geometry.py
+++ b/pyresample/geometry.py
@@ -1447,10 +1447,13 @@ class _ProjectionDefinition(BaseDefinition):
 def masked_ints(func):
     """Return masked integer arrays when returning array indices."""
     @wraps(func)
-    def wrapper(self, xm, ym):
+    def wrapper(self, xm, ym, allow_half_pixels=False):
         is_scalar = np.isscalar(xm) and np.isscalar(ym)

         x__, y__ = func(self, xm, ym)
+        if not is_scalar and allow_half_pixels:
+            x__ = np.clip(x__, 0, self.width - 1)
+            y__ = np.clip(y__, 0, self.height - 1)
         x__ = np.round(x__).astype(int)
         y__ = np.round(y__).astype(int)

My gut feeling is that the clipping should always be used. The decorator is used only twice and both seem to get array indices so where this issue will give unexpected results.

@mraspaud
Copy link

mraspaud commented Apr 19, 2024

My understanding of this modification is that the clipping renders the masking useless, and thus no data is ever masked.

So if I provide a lon/lat array that produces eg [-1, 0, 1, 2, ...] for x and [..., 7, 8, 9, 10] for y (supposing a 10x10 array) then masked ints will not return [-, 0, 1, 2, ...] for x and [..., 7, 8, 9, -] for y, but [0, 0, 1, 2] for x and [7, 8, 9, 9] for y. I'm not sure what the effect would be if this is then used for indexing an array.

Or am I missing something?

@djhoese
Copy link
Member

djhoese commented Apr 19, 2024

@mraspaud You are not missing anything, but @pnuu is right too that masked_ints is only used for the two "array indices". I think the main takeaway from exploring this is that there are two uses cases for these methods but only one is covered by the code currently:

  1. Is this point in the area? Or similarly, give me the array value for this point. This use case is easy to consider when you think of scalar input coordinates or something like an array of lon/lats (SwathDefinition) and you want all the points corresponding to an AreaDefinition.
  2. Bounding array indices as used by the get_area_slices logic. When we have a boundary instead of a 2D array of lon/lats (a "raster" of coordinates) then masking doesn't make sense. BUT maybe this clipping shouldn't be in these methods? I'm not sure.

@pnuu
Copy link

pnuu commented Apr 19, 2024

Oh, right. I missed that the other use is for lonlats.

@djhoese
Copy link
Member

djhoese commented Apr 20, 2024

Ok here's a slightly less controversial change I think:

diff --git a/pyresample/geometry.py b/pyresample/geometry.py
index 70e1c62..0a0250b 100644
--- a/pyresample/geometry.py
+++ b/pyresample/geometry.py
@@ -1451,11 +1451,14 @@ def masked_ints(func):
         is_scalar = np.isscalar(xm) and np.isscalar(ym)

         x__, y__ = func(self, xm, ym)
+        epsilon = 0.02  # arbitrary buffer for floating point precision
+        x_mask = ((x__ < -0.5 - epsilon) | (x__ > self.width - 0.5 + epsilon))
+        y_mask = ((y__ < -0.5 - epsilon) | (y__ > self.height - 0.5 + epsilon))
+        x__ = np.clip(x__, 0, self.width - 1)
+        y__ = np.clip(y__, 0, self.height - 1)
         x__ = np.round(x__).astype(int)
         y__ = np.round(y__).astype(int)

-        x_mask = ((x__ < 0) | (x__ >= self.width))
-        y_mask = ((y__ < 0) | (y__ >= self.height))
         x_masked = np.ma.masked_array(x__, mask=x_mask, copy=False)
         y_masked = np.ma.masked_array(y__, mask=y_mask, copy=False)
         if is_scalar:

Plus sides: This fixes these index methods including up to 0.5 whole pixel more than they should on the right (the mask should have been self.width - 0.5 to include the outer extent but not further) and 0.5 less pixels on the left (the mask limit should have been -0.5). It includes some wiggle room by using 0.02 outside of the area extents to avoid floating point issues with lon/lat -> x/y and other calculations.

This has a downside that the masked pixels are now clipped/modified whereas before they remained their invalid out-of-bounds index values. I did it this way because it avoids me having to do weird complex clipping logic like x__[(x__ > -0.5 - epsilon) && (x__ < 0)] = 0.

@djhoese djhoese self-assigned this Apr 20, 2024
@djhoese djhoese added the bug label Apr 20, 2024
@mraspaud
Copy link

Your last solution looks like a good compromise.
However, maybe that function being used for two different purposes shows we should actually have two functions instead of one?

@djhoese
Copy link
Member

djhoese commented Apr 22, 2024

That was going to be my other idea before I came up with the masked one above. However, I'm not sure these are technically different use cases, but rather stricter rules for how the methods/functions need to behave. I think there is a method that returns the floating point row/col indexes and if so then the get_area_slices could use that and do the rounding as needed. My above solution though definitely fixes some bugs though so I think it is still accurate. I could do more work to retain the invalid values underneath the mask if that is desired, but otherwise the above solution still fits in with the previous behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants