Hi Andreas,
Please see step 7 of the Greenland example. Here, we translate a smb forcing from a 45 70 projection into the 39 71 projection of the model.
We save the smb to a mat file (x1,y1,smbmean) in step 6.
%convert mesh x,y into the Box projection
= xy2ll(md.mesh.x,md.mesh.y,+1,39,71);
= ll2xy(md.mesh.lat,md.mesh.long,+1,45,70);
%Interpolate and set surface mass balance
index = BamgTriangulate(x1(:),y1(:));
smb_mo = InterpFromMeshToMesh2d(index,x1(:),y1(:),smbmean(:),xi,yi);
The trick is to translate the model mesh coordinates into the coordinate system of your input data, and then pass the
transformed x and y into the interpolation routine. The resulting vector should be projected correctly for your model.
I hope this helps.
Thank you,
Nicole