Found GLM file that has a higher number of events then current dytpe (int16) can hold for flash_np['n_points'] in io/mimic_lma.py #102
Conversation
…'] to unsigned int16
|
One thing that may need to be considered with this is if these files go directly to AWIPS or to any other Java software as Java doesn't have unsigned types. I have no say in this library or the CSPP downstream project using it, but Java limitations were the first thing that came to mind when I saw this PR. |
|
Does it actually affect a datatype in an output file, or is it just an internal counter? If the latter then that should eliminate the Java concern. Having said that, I would suggest promotion to int32, to head off the same problem happening when there's a case that exceeds 65,535 counts. |
|
Good point. They'd probably be translated to something like another AWIPS-compatible NetCDF file. I do know sometimes data file support is added directly to AWIPS, but maybe GLM is too complicated for that to have been done already (ex. groups and flashes), hence the CSPP/Satpy conversion steps. |
…'] to (signed) int32
|
Thanks for the input all, (And I didn't realize that Java didn't have unsigned types) I have gone ahead and updated the source branch for this pull request to be signed int32. The branch name is no longer accurate but I guess thats a lesson for me about branch names going forward 😅 |
There exists a GLM file (Goes18 01/12/2025 - 06:33:00) where the number of events (33601) is larger then a signed int16 (as n_points is set to here) can handle (max of 32,767).
When I try to grid that file I get this error:
My commit fixes the issue by changing it to an unsigned int which should be good up to 65,535
To fix this specific issue I only needed to update n_events dtype for [flash_dtype_fixedgridlut] (https://github.com/deeplycloudy/glmtools/blob/master/glmtools/io/mimic_lma.py#L609) but I thought it would make sense to do it for n_events dtype for flash_dtype as well.
I'm happy to change that or switch the dytpe to signed int32 (if it needs to be signed).