-
Notifications
You must be signed in to change notification settings - Fork 63
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
Problem with NCDF_VARGET call under GDL ... Problem reading Unsigned Byte Arrays #1983
Comments
if you send me your email i can send you the test file and the PRO code. Thank you so much! |
the PRO code runs very fast. Just a few seconds. So you can easily try running it on your end. Works great under IDL ... Note that I can read unsigned byte arrays (0 to 255) with that call, with no issues under IDL The same read of an unsigned byte array (0 to 255) fails with these erros under GDL I think under GDL that call is expecting byte values to always range from -128 to 127 (as it would for a signed byte arrays) so when it encounters an unsigned byte array with values from 0 to 255, it chokes. If you could change that call to allow for values up to 255 ... instead of up to 127 ... i think it would solve the problem. THanks for looking at this! |
pro read_mod06_testbyte ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUG = 1 ncid = NCDF_OPEN('MOD06_L2.A2003001.2140.007.2023121190627.nc') ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NCDF_CLOSE, ncid end |
above is what my PRO code looks like. The whole thing (all three variables read in) works fine under IDL Under GDL, the 3rd variable read CHOKES under GDL ... when it tried to read in an Unsigned Byte array (value range 0 to 255) |
@phubanks see #1922. Changes were made by @rsiddans to support the NC_UINT case. |
Hello GillesDuvert, I REALLY appreciate your response to me. Thank you! You mentioned a fix to support the NC_UINT case done in late november 2024. Did that change also support a fix to the NC_UBYTE case, since my issue is with reading unsigned byte arrays. I was trying to interpret fully what you wrote, do i have this correct? So are you saying that someone there added a patch to an interim (unreleased version) in late Nov 2024 -- however it sounds like there was never a new "official release" of GDL with that patch included, correct? So, will there be a new official release soon (v1.2 perhaps) that will include that UNSIGNED BYTE read enhancement? In the meantime, sounds like you are suggesting i have my sys admins install a later version of GDL, which is currently marked as "unstable" from your weekly archive. Correct? Does unstable mean it might have some problems or bugs? Thanks so much for any information you can provide |
In fact, there will be a 1.1.1 right now. And @rsiddans pull request concerned AFAIK the ubyte too. |
If you use the current wekly release and your problem disappears, please tell us, so that I could close this issue and indicate in the coming 1.1.1 release notes that NCDF_commands support now the unsigned types. |
Hello GillesDuvert, Thank you SO MUCH for your quick response. I really appreciate it! You wrote that "there will be a 1.1.1 right now", Any rough idea on when that releases page will show the new v1.1.1 version as being available.. The reason i ask is i have to ask my sys admins to install it, and I think they'll be a lot more comfortable installing an official release vs. your unofficial weekly release (I am worried about them balking at the term "unstable". Even tho as you said the weekly release will be identical to the upcoming v1.1.1. release. I still have to "sell" the idea to my sys admins -- convincing other people who are in power to install that. If you could update the official releases page to show a v1.1.1 is now available, and show that v1.1.1 as a list of "assets" I will have a much easier time convincing the sys admins to install that update. Do you think you might update that releases page within the next few days? or do you have a rough estimate in terms of days or weeks when you think that might happen. Thanks again for all your hard work on this. |
ah I see... I do not know your personal situation but I believe that |
there is one thing different between the weekly version and the last official version ... |
thank you!! |
1.1.1 is out. |
Just to say that my patch for NC_UINT also attempted to fix other unsigned types including NC_UBYTE, though was not possible to test all datatypes. I did try a few different ncdf files, though so would be fairly optimistic. If you can point me at an e.g. of the .nc file you are trying to read I could try it out (I see it's MODIS L2 but only have access to hdf versions of those). BTW I can confirm it not necessary to be sys admin to get working copy of gdl working - i do that using git following the instructions for "Cloning GDL" on this page https://gnudatalanguage.github.io/ |
Hello RSIDDANS,
Thank you so much for responding and asking if you could test to see if you latest weekly updated version of GDL fixes my problem
I uploaded a testing program and a testing input file to this web directory.
https://mindstar.com/test/
Download these 2 files.
The short test program attempts to read in 3 variables – and the third variable read (SDS = Quality_Assurance_1km)
Which is an unsigned byte array, works under IDL but fails under my old version of GDL.
If you run the test program under IDL, it works fine and finishes successfully
However if you run it under the old version of GDL that I have installed, it creates the following error.
When trying to read the 3rd variables (the unsigned byte array)
See read text below
…
Reading Unsigned Byte Variable: Quality_Assurance_1km
Valid Data Range: 1 to 255
Fill Value: 0
varid = 88
Get Info on Var to be read with: NCDF_VARINQ(groupid, varid)
More info about this variable about to be read
Possible DataTypes: BYTE, CHAR, INT, LONG, FLOAT, DOUBLE
{ VarName, DataType, NDims, NumAtts, Dimensions_ID_Vector }
NCDF_VARINQ Result = { Quality_Assurance_1km BYTE 3 12 9 3 5. }
% Warning in NCDF_VARGET: NC_ERANGE during BYTE reading
% NCDF_VARGET: (NC_ERROR=-60)
% Execution halted at: READ_MOD06_TESTBYTE 147 /home/phubanks/_m7_profile_7.0.3/_TEST0/read_mod06_testbyte.pro
% $MAIN$
If you can test this and let me know if that latest GDL weekly version works, that would be great !!
From: rsiddans ***@***.***>
Date: Monday, February 10, 2025 at 4:28 AM
To: gnudatalanguage/gdl ***@***.***>
Cc: Hubanks, Paul A. (GSFC-613.0)[ADNET SYSTEMS INC] ***@***.***>, Mention ***@***.***>
Subject: [EXTERNAL] [BULK] Re: [gnudatalanguage/gdl] Problem with NCDF_VARGET call under GDL ... Problem reading Unsigned Byte Arrays (Issue #1983)
CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.
Just to say that my patch for NC_UINT also attempted to fix other unsigned types including NC_UBYTE, though was not possible to test all datatypes. I did try a few different ncdf files, though so would be fairly optimistic. If you can point me at an e.g. of the .nc file you are trying to read I could try it out (I see it's MODIS L2 but only have access to hdf versions of those).
BTW I can confirm it not necessary to be sys admin to get working copy of gdl working - i do that using git following the instructions for "Cloning GDL" on this page https://gnudatalanguage.github.io/
I clone the code to a dir under my home dir, then following the instructions in README and INSTALL.CMake.
—
Reply to this email directly, view it on GitHub<#1983 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BMF2OALBGHOF4UTEVSZTVWL2PBWLPAVCNFSM6AAAAABWWLKFV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBXGQYTIMBXG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
OK I tested it and I think the file is read fine with the version of gdl I have (working version from last month). I attach output from running your script in gdl and idl. So you should be fine with the gdl v1.1.1 release. |
You guys are brilliant over there! Thank you so much
That GDL output looks perfect
So will the v1.1.1 release become an official release sometime this week?
I think someone over there emailed that it may come on Wednesday 12 Feb?
I realize it will be identical to the weekly unofficial release, but I need to convince my Sys Admins to do a global install for the entire network.
And an officially released version will be an easier sell.
Thanks again for all your help
I am very grateful.
Five gold stars to everyone over there.
By the way I got this email over the weekend …
@slayoo has invited you to join the gnudatalanguage organization
I just wanted to understand what that meant.
From: rsiddans ***@***.***>
Date: Monday, February 10, 2025 at 10:03 AM
To: gnudatalanguage/gdl ***@***.***>
Cc: Hubanks, Paul A. (GSFC-613.0)[ADNET SYSTEMS INC] ***@***.***>, Mention ***@***.***>
Subject: [EXTERNAL] [BULK] Re: [gnudatalanguage/gdl] Problem with NCDF_VARGET call under GDL ... Problem reading Unsigned Byte Arrays (Issue #1983)
CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.
OK I tested it and I think the file is read fine with the version of gdl I have (working version from last month). I attach output from running your script in gdl and idl. So you should be fine with the gdl v1.1.1 release.
output_gdl.txt<https://github.com/user-attachments/files/18735623/output_gdl.txt>
output_idl.txt<https://github.com/user-attachments/files/18735624/output_idl.txt>
—
Reply to this email directly, view it on GitHub<#1983 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BMF2OAP2T5LOQLZV53ODQDD2PC5VDAVCNFSM6AAAAABWWLKFV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBYGI4TINRQGE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
That's a GitHub users group where we invite anyone who uses GDL, so that one may @-tag the group in case of new releases or announcement: https://github.com/orgs/gnudatalanguage/teams/gdlteam |
v1.1.1 is official since yesterday, see: https://github.com/gnudatalanguage/gdl/releases |
Hello GDL Support Team,
Thanks for all your hard work over there. You guys and gals have been very responsive so far about issues with GDL. And I really appreciate it.
I am having trouble running a short IDL program under GDL (version 1.0.5) which is readng a NetCDF4 file
I am getting the following error under (GDL) ... meanwhile my code works fine with no errors under IDL
It appears from what i've been able to debug ... that the issue occurs when i try to read an
UNSIGNED BYTE array with values that range from 0 to 255
(note that signed byte arrays have values that range from -128 to 127, and those arrays work fine)
The GDL error occurs when i use the following command ... to read in an unsigned byte array with values ranging from 0 to 255.
NCDF_VARGET, groupid, varid, data
Its interesting but this call to NCDF_VARGET works FINE under IDL but fails under GDL.
I can send you my PRO program and testing NetCDF4 file that you can download if you give me your email address, or provide me another way to upload a file to you. Note the NetCDF4 file is big at nearly 500MB.
So one question i have is ... perhaps there is some OPTION to NCDF_VARGET under GDL which is missing? I cant find anything in the manual about that.
My guess is that NCDF_VARGET call under GDL is demanding that the byte array be signed and that the values stay in the -128 to 127 range ... but when it sees an array with values ranging from 0 to 255 (as occurs in an unsigned byte array) that call chokes. This is not an issue under IDL but fails under GDL, so i think there might be a bug in a call under GDL? or if not perhaps I am not calling this function correctly?
Any help or insight you can offer would be fantastic.
Some output from my program is show below ... just before the program errors and quits:
varname = Quality_Assurance
NCDF_VARINQ Result = { Quality_Assurance BYTE 3 11 2 0 1 }
Reading Data with: NCDF_VARGET, groupid, varid, data
% Warning in NCDF_VARGET: NC_ERANGE during BYTE reading
% NCDF_VARGET: (NC_ERROR=-60)
% Execution halted at: READ_ATMOS_L2_NC 184 /home/phubanks/_m7_profile_7.0.3/read_atmos_l2_nc.pro$MAIN$
% WRITE_YORI_INPUT_PROFILE_GDL 489 /home/phubanks/_m7_profile_7.0.3/write_yori_input_profile_gdl.pro
%
GDL> exit
The text was updated successfully, but these errors were encountered: