I have an application with wxpython in which I can read and show NetCDF4 file and some information like x y coordinates.
what I need is the numerical value or pixel value for the variable air dep which corresponds to the coordinates cursor x y : x = col & y = row :(X 89.98774193548385, Y 35.8141935483871).
My NetCDF file has some variables and I need just this information for variable "air_dep".
The code is shown below:
In [1]: import numpy as np^M
...: import netCDF4^M
...: from netCDF4 import Dataset^M
...: ^M
...: fic='air.departure.sig995.2012.nc'^M
...: ^M
...: path='D:/data/'^M
...: ^M
...: nc = netCDF4.Dataset(path+fic,'r')
In [2]:
In [2]: nc
Out[2]:
<class 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
description: The departure of the NCEP/NCAR Reanalysis air temperature from its value at Darwin, Australia. Data is from NMC initialized reanalysis
(4x/day). These are the 0.9950 sigma level values.
dimensions(sizes): lat(73), lon(144), time(366)
variables(dimensions): float32 lat(lat), float32 lon(lon), float64 time(time), float64 air_dep(time,lat,lon)
groups:
In [3]: nc.variables.keys()
Out[3]: odict_keys(['lat', 'lon', 'time', 'air_dep'])
I know the code is in wxpython but i just edit the code without GUI and ploting python3.6.
That's what I have, I can just show the x y but what I need is the numeric value and lat-lon at this point! i'm new in netCDF4