Graph Machine Learning
AnemoI
English
anaprietonem commited on
Commit
3ce7034
·
verified ·
1 Parent(s): 9cacbc2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -4
README.md CHANGED
@@ -96,15 +96,36 @@ Below you can find an example to read that file and load it as numpy array or xa
96
  ```
97
 
98
  import earthkit.data as ekd
 
 
99
 
100
  source_filename='anemoi.grib'
101
  aifs_forecast = ekd.from_source('file',source_filename)
102
 
103
- # to load it as a numpy array
104
- aifs_forecast.to_numpy() #
105
 
106
- # to load it as a xarray array
107
- aifs_forecast.to_xarray()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
  ```
110
 
 
96
  ```
97
 
98
  import earthkit.data as ekd
99
+ import cartopy.crs as ccrs
100
+ import numpy as np
101
 
102
  source_filename='anemoi.grib'
103
  aifs_forecast = ekd.from_source('file',source_filename)
104
 
105
+ # to load a variable as a numpy array
106
+ aifs_forecast.sel(param="2t").to_numpy()
107
 
108
+ # to load a variables as an xarray array
109
+ aifs_forecast.sel(param="2t").to_xarray()
110
+
111
+ aifs_forecast_2t_xr = aifs_forecast.sel(param="2t").to_xarray()
112
+
113
+ fig, axes = plt.subplots(subplot_kw={'projection': ccrs.Robinson()}, figsize=(16,6))
114
+
115
+ map_scatter(data_v021_2t_xr.latitude, data_v021_2t_xr.longitude, data_v021_2t_xr.t2m[0,1,0,:],
116
+ axes=axes,
117
+ proj=ccrs.Robinson(),
118
+ vmin=np.percentile(data_v021_2t_xr.t2m[0,1,0,:], 2),
119
+ vmax=np.percentile(data_v021_2t_xr.t2m[0,1,0,:], 98),
120
+ cmap="RdYlBu_r",
121
+ mask_ocean=True,
122
+ plot_title='2-Meter Temperature Forecast',
123
+ cmap_label="Temperature (K)"
124
+ )
125
+
126
+ <div style="display: flex; justify-content: center;">
127
+ <img src="2t_aifs_v021.jpeg" alt="Encoder graph" style="width: 50%;"/>
128
+ </div>
129
 
130
  ```
131