Skip to content Skip to sidebar Skip to footer

Convert Netcdf "land" Variable To Latitude And Longitude With Python

I have a global meteorological dataset and I want to access the data for a certain grid (lat,lon). However, the data is compressed, i.e. the parameters of interest do not have the

Solution 1:

Some others might find this helpful, so here's the answer to the problem. A friend figured it out for me. "land" is the index of the flattened array nav_lat, nav_lon, i.e. the first entry of "land" corresponds to the latitude: lat.flat[land[0]] and lon.flat[land[0]].

Solution 2:

You can extract variables from ncfile using

lat = ncfile.variables['nav_lat'][:,:]
lon = ncfile.variables['nav_lon'][:,:] 

This will create 2D numpy arrays lat and lon.

Post a Comment for "Convert Netcdf "land" Variable To Latitude And Longitude With Python"