<jupyter_start><jupyter_text>Import libraries<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

# We can use this module to open/read/write netCDF files
from scipy.io import netcdf<jupyter_output><empty_output><jupyter_text>Open and read a netCDF file  'lat', 'lon' and 'T_MIN_L103_Pd' variables are what we need<jupyter_code>file = netcdf.netcdf_file("./20111207.nc")

file.variables<jupyter_output><empty_output><jupyter_text>Take a look at longitude, latitude and temperature data<jupyter_code>lon = file.variables['lon'].data
print(lon.shape)
print(lon)
lat = file.variables['lat'].data
print(lat.shape)
print(lat)<jupyter_output>(151,)
[ 90.  89.  88.  87.  86.  85.  84.  83.  82.  81.  80.  79.  78.  77.
  76.  75.  74.  73.  72.  71.  70.  69.  68.  67.  66.  65.  64.  63.
  62.  61.  60.  59.  58.  57.  56.  55.  54.  53.  52.  51.  50.  49.
  48.  47.  46.  45.  44.  43.  42.  41.  40.  39.  38.  37.  36.  35.
  34.  33.  32.  31.  30.  29.  28.  27.  26.  25.  24.  23.  22.  21.
  20.  19.  18.  17.  16.  15.  14.  13.  12.  11.  10.   9.   8.   7.
   6.   5.   4.   3.   2.   1.   0.  -1.  -2.  -3.  -4.  -5.  -6.  -7.
  -8.  -9. -10. -11. -12. -13. -14. -15. -16. -17. -18. -19. -20. -21.
 -22. -23. -24. -25. -26. -27. -28. -29. -30. -31. -32. -33. -34. -35.
 -36. -37. -38. -39. -40. -41. -42. -43. -44. -45. -46. -47. -48. -49.
 -50. -51. -52. -53. -54. -55. -56. -57. -58. -59. -60.]<jupyter_text>Note, the first dimension of temperature data is time. 4 represents 12AM, 6AM, 12PM and 6PM in a day.<jupyter_code>temperature = file.variables['T_MIN_L103_Pd'].data
print(temperature.shape)
print(temperature)<jupyter_output>(4, 151, 361)
[[[246.1 246.1 246.1 ... 246.1 246.1 246.1]
  [243.9 243.9 243.9 ... 243.8 243.9 243.9]
  [242.2 242.2 242.2 ... 242.2 242.2 242.2]
  ...
  [277.3 277.4 277.6 ... 277.3 277.3 277.3]
  [276.7 276.8 276.7 ... 276.2 276.5 276.7]
  [275.9 275.7 275.4 ... 275.6 275.8 275.9]]

 [[244.2 244.2 244.2 ... 244.2 244.2 244.2]
  [243.7 243.6 243.6 ... 243.7 243.7 243.7]
  [241.6 241.6 241.5 ... 241.6 241.6 241.6]
  ...
  [277.1 277.6 278.  ... 277.6 277.3 277.1]
  [277.  277.1 277.2 ... 277.3 277.2 277. ]
  [276.8 276.3 275.9 ... 276.5 276.8 276.8]]

 [[241.9 241.9 241.9 ... 241.9 241.9 241.9]
  [239.1 238.9 238.8 ... 239.4 239.3 239.1]
  [240.8 240.5 240.3 ... 241.1 240.9 240.8]
  ...
  [277.1 277.3 277.9 ... 278.2 277.6 277.1]
  [276.9 276.6 277.  ... 277.3 277.2 276.9]
  [276.6 276.1 275.9 ... 276.6 276.8 276.6]]

 [[239.6 239.6 239.6 ... 239.6 239.6 239.6]
  [236.6 236.6 236.7 ... 236.6 236.6 236.6]
  [237.9 237.9 237.9 ... 237.9 237.9 237.9]
  ...
  [278.5 278.3 278.3 ... 278.7 2[...]<jupyter_text>All data above are of `numpy.ndarray` type. We can process the same day in all 10 years, day by day to get what we want.  Visualization I'm not too worried about visualization now since all data are numpy arrays, but just in case you want to see<jupyter_code>fig, ax = plt.subplots(figsize=(12, 5), dpi=300)
heatmap = ax.pcolormesh(lon, lat, temperature[1])
ax.set_title('World temperature map, 12/07/2011', size=20)
ax.set_xlabel('Longitude', size=16)
ax.set_ylabel('Latitude', size=16)
fig.colorbar(heatmap, label='Temperature (K)')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19913686806411837, 'fraction_numerical': 0.2632552404438964, 'mean_word_length': 1.9825367647058822, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '585434', 'license': 'MIT', 'n_tokens_mistral': 2061, 'n_tokens_neox': 1506, 'n_words': 424, 'path': 'Playground/netCDF4_playground_DG.ipynb', 'repo_name': 'urseaned/ev_temp_map', 'size': '3244'}