ncdf global attribute exists function [message #93957] |
Wed, 07 December 2016 04:46  |
Mark Shephard
Messages: 13 Registered: July 1999
|
Junior Member |
|
|
Hi,
I have looked through all the IDL documentation in regards to ncdf, but cannot seem to find a nice solution. I was wondering if anyone had a simple function to check if a global attribute exists in an netCDF file.
I can use the ncdf_get to get all the global attributes (gatt) and then check the hash to see if the key exists, but this seems to have a lot of overhead. I was looking for something similar to the cdf_attexists(id, attribute_name) procedure, but for ncdf that works on global attributes.
Thanks,
Mark
|
|
|
Re: ncdf global attribute exists function [message #93959 is a reply to message #93957] |
Wed, 07 December 2016 09:26  |
Lajos Foldy
Messages: 176 Registered: December 2011
|
Senior Member |
|
|
On Wednesday, December 7, 2016 at 1:46:32 PM UTC+1, Mark Shephard wrote:
> Hi,
>
> I have looked through all the IDL documentation in regards to ncdf, but cannot seem to find a nice solution. I was wondering if anyone had a simple function to check if a global attribute exists in an netCDF file.
>
> I can use the ncdf_get to get all the global attributes (gatt) and then check the hash to see if the key exists, but this seems to have a lot of overhead. I was looking for something similar to the cdf_attexists(id, attribute_name) procedure, but for ncdf that works on global attributes.
>
> Thanks,
> Mark
What about
function ncdf_global_attr_exists, ncid, attr_name
return, (ncdf_attinq(ncid, attr_name, /global)).length gt 0
end
regards,
Lajos
|
|
|