Closed allibco closed 3 years ago
This is the problematic call:
for d in datas: raw_metrics.append(mp.get_metrics(d))
Note: add this plot to the test suite so we catch this issue if it comes back up
starting on line 154 on plot.py, the ordering of the dimensions is not necessarily consistent (for example if we use subset_data() before getting the metrics), so we need a way to make sure we are finding the names of the latitude and longitude dimensions without using the ordering.
In the case above, there are three dimensions which have been reordered after using subset to ("lon", "lat", "time") and so we end up averaging over "lat" and "time", when we would expect to be averaging over "lat" and "lon"
if len(da_data.dims) == 2:
lat_dim = da_data.dims[0]
lon_dim = da_data.dims[1]
elif len(da_data.dims) == 3:
lat_dim = da_data.dims[1]
lon_dim = da_data.dims[2]
elif len(da_data.dims) == 4:
lat_dim = da_data.dims[3]
lon_dim = da_data.dims[4]
This will be fixed in my pull request shortly....
From the tutorial notebook:
Time series plot of PRECT mean data for col_prect "zfpA1e-7" dataset at the location (44.76, -123.75)
ldcpy.plot( col_prect, "PRECT", sets=["zfpA1e-7"], calc="mean", plot_type="time_series", lat=44.76, lon=-123.75, ) This is in the tutorial, and in my branch it is broken (probably broken in main, too) - I understand why it is broken, but I think this plot doesn't make sense. What are we calculating the mean of? Basically the code is trying to do the mean over time since we have only one point - but then the time dimension gets dropped and you can't plot a time series. So I'm wondering if this is a bad example in the tutorial or we need to fix the code so calc=None is an option - then it just prints the values?