Skip to content

Instantly share code, notes, and snippets.

@AntSimi
Created November 16, 2020 10:21
Show Gist options
  • Save AntSimi/801c22c5cb1ee730cc91effda23c0ab7 to your computer and use it in GitHub Desktop.
Save AntSimi/801c22c5cb1ee730cc91effda23c0ab7 to your computer and use it in GitHub Desktop.
Few check on trackeddy_V1-0_global_eddies.nc
from netCDF4 import Dataset
from matplotlib import pyplot as plt
with Dataset('trackeddy_V1-0_global_eddies.nc') as h:
# with Dataset('http://dapds00.nci.org.au/thredds/dodsC/ks32/CLEX_Data/TrackEddy_eddies/v1-0/netcdf/trackeddy_V1-0_global_eddies.nc') as h:
# Variable
time = h.variables["time"][:]
neddy = h.variables["neddy"][:]
longitude = h.variables["center_mass_loc_x"][:]
latitude = h.variables["center_mass_loc_y"][:]
# Order
# I didn't understand how data are ordering, i wonder there is a reason
# that explain why there are not sorting by time or position
print(time[:10])
print(neddy[:10])
print(longitude[:10])
print(latitude[:10])
# Detection over land
fig =plt.figure()
ax = fig.add_subplot(111)
ax.set_title('Detection over italian land')
ax.set_aspect('equal'), ax.grid()
m = (longitude < 15) * (longitude > 10) * (latitude >41) * (latitude < 44)
ax.plot(longitude[m], latitude[m], '.', markersize=.5)
# 0 longitude missing detection
longitude = (longitude + 180) % 360 -180
m = (longitude < 10) * (longitude > -10) * (latitude >-40) * (latitude < -30)
fig =plt.figure()
ax = fig.add_subplot(111)
ax.set_title('No detection at longitude 0°')
ax.set_aspect('equal'), ax.grid()
ax.plot(longitude[m], latitude[m], '.', markersize=.5)
#
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment