This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Arturo, That is just a warning letting you know that the library, while it tries to automatically mask bad values using metadata like the "valid_range" attribute, is ignoring the "valid_range" attribute for your variable because the attribute has a different type than that of the original data values. It's only a warning, so your data should be fine, it's just that bad/missing values may not be properly masked. For more information, see this GitHub issue: https://github.com/Unidata/netcdf4-python/issues/707 Ryan > > I have worked with netCDF files in python before but only extracting single > values based on specific lat and lon combinations. This time I am having to > slice a variable to get all values that fall within a specific grid. My > script is working with no errors. However, on the first extraction in a loop > I am getting the following warning: > > UserWarning: WARNING: valid_range not used since it > cannot be safely cast to variable data type. > > I am using Anaconda as my development environment and using files from the > following link: > > https://ecocast.arc.nasa.gov/data/pub/gimms/3g.v1/ > > I just want to make sure that I am not doing anything wrong regarding > incorrect libraries, etc. > > Any advice would be appreciated. Thank you very much. Ticket Details =================== Ticket ID: NPB-553460 Department: Support Python Priority: Normal Status: Closed =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.