I have a pandas data frame (90720 rows) consisting of longitude, latitude, and variable columns. The data represent points on a 1.3 km resolution grid but are not in any particular order within the data frame. An example of the dataset looks like:
| lon | lat | var |
|---|---|---|
| 40.601700 | -90.078857 | 0.006614 |
| 40.598942 | -90.031372 | 0.048215 |
| 40.592426 | -89.920563 | 0.012860 |
| 40.591480 | -89.904724 | 0.006642 |
| 40.590546 | -89.888916 | 0.005383 |
| 43.642635 | -89.904724 | 0.012860 |
| 40.590546 | -84.545715 | 0.012860 |
I would like to convert these lat/lon/var points into a gridded dataset. Most approaches I have tried (df.pivot) require significant memory due to the size of the data frame. The final gridded data should have a shape of (288,315). Ultimately, I want to plot this data with plt.colormesh() to compare it with other datasets. I appreciate any suggestions!
