Closed acapet closed 4 years ago
Hi!
I think you should try something like this :
from numpy import meshgrid
# create mesh
lats, lons = meshgrid(g.y_c, g.x_c)
shape = lats.T.shape
# flat grid before interp
lons, lats = lons.reshape(-1), lats.reshape(-1)
# interp and reshape
ti = g.interp('sst', lons, lats).reshape(shape)
In my mind masked array or not must be the same, but when i read function ... if it's a problem send traceback
I wonder why you want interpolate sst grid on sla resolution before assess mean SST anomalies within contours? You could get sst pixel within contours directly .
Antoine
Thanks, that's exactly what I needed. For the record, here's how I got through :
from numpy import meshgrid
lons, lats = meshgrid(g.x_c, g.y_c)
shape = lats.shape
# flat grid before interp
lons, lats = lons.reshape(-1), lats.reshape(-1)
# interp and reshape
ti = t.interp('analysed_sst', lons, lats).reshape(shape).T
ti = ma.masked_invalid(ti)
g.add_grid('sst',ti)
I masked it for later use e.g. g.add_grid('sst_anom',ti-ti.mean())
.
The reason I loaded SST everywhere, and not only within contours at this stage, is for a first visual inspection.
Thanks !!!
(PS: I'm preparing a show case with corresponding data files for the gallery)
It seems that add_grid doesn't complete g.variables_description. As a consequence, I can't for instance use
g.copy("sst", "sst_high")
g.bessel_high_filter('sst_high',100)
to higlight anomalies in SST.
Any hint ?
Ok, I went over this issue with
g.variables_description['sst'] = t.variables_description['analysed_sst']
but I'm unsure it would be entirely correct, since there has been an interpolation in between these two..
Good, maybe i will add a method to re-grid a grid on another one (with same code of interpolation) to take all informations in one command
Hi !
I'm trying to load external data (SST) using the same data structure for collocation (eg. assess mean SST anomalies within contours).
I think I'm almost there, just miss the interpolation step.
So far, so good. Then I'd like to use :
with
but something is wrong.
Among what I noticed :
ti.shape=(120,)
, instead ofg.grid('sla').shape=(120,56)
. Should I use a meshgrid of g.grid(lon_name),g.grid(lat_name) before calling interp ?Thanks for insights !!
Art