time interpolation of a 3d matrix containing wind speed data

6 views (last 30 days)
Hello everyone,
I am not an expert user and I would like to ask some information regarding time interpolation. I am running simulations to generate wind waves and as you know, the crucial point is to have wind data with good quality. For my simulations I used ERA5 wind data ( reanalysis) but I was told to compare the wind field with wind data coming from altimeters, for example IFREMER. The objective of the comparison is to correct some possible biases in the wind field.
Now, the problem is that ERA5 collects data every hour while IFREMER provides data every 6 hours. Since I am now focusing on the year 2011, for example, in the first case I have 8760 values while in the second case I have 1460 values.
Basically I have two 3D matrices: u10_ERA5 (81x109x8760) and u10_IFREMER (81x109x1460). The first two dimensions represent wind intensity for defined sets of longitude and latitudes ( the same for both matrices). Since the wind data coming from IFREMER is more accurate, I would like to modify the ERA5 matrix in order to increase the quality of the wind.
Here I attached two drawings I made ( just to give an idea of what I am thinking to do)
Could you provide a code that can help me in this?
Thank you a lot

Answers (1)

Star Strider
Star Strider on 3 Jun 2023
The retime or synchronize would likely be more apporpriate here, however the resample function could work (and interp1 is an option as well). I would downsample the hourly data to the every-six-hour data rather than upsample the every-six-hour data. The reason is that upsampling creates data where none previously existed. You cannot determine what the IFREMER data actually were at the hourly times, so any comparisons of interpolated hourly data to the ERA5 data would likely not be valid.
So I would use retime or synchronize to downsample the ERA5 data to the same times as the IFREMER data and go from there.
  2 Comments
Tiziano Bagnasco
Tiziano Bagnasco on 5 Jun 2023
thank you a lot for your answer! I actually relized that the two 3d matrices are defined on the same longitude and latitude points but for u10_ERA5 latitude goes from 29 to 2 degrees while for u10_IFREMER latitude goes from 2 to 29. Which means that I cannot make comparisons considering the same index, right?
I need to rearrange one of the two matrices but i don't kow how.. Do you know a way to do it? thank you again.
Star Strider
Star Strider on 5 Jun 2023
Edited: Star Strider on 5 Jun 2023
My pleasure!
This might be possible using the flip function, however I would need your data to experimant with, since I do not know how to simulate it.
EDIT — (5 Jun 2023 at 14:32)
I just now figured out how to simulate it.
The flip approach seems to work, although the plots are the same because of the way the MATLAB plotting functions (here surf) work.
The matrices themselves are flipped appropriately, as can be seen by examining the first and third dimensions of both ‘A3’ and ‘flipLatA3’ (the second dimension is the same column-wise, so it does not demonstrate any changes) —
Latv = linspace(29,2, 7);
Lonv = linspace(90, 120, 8);
[Lat,Lon] = ndgrid(Latv,Lonv);
WVel = Lat.^2/100 + Lon.^2/100;
A3 = cat(3, Lat,Lon, WVel)
A3 =
A3(:,:,1) = 29.0000 29.0000 29.0000 29.0000 29.0000 29.0000 29.0000 29.0000 24.5000 24.5000 24.5000 24.5000 24.5000 24.5000 24.5000 24.5000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 15.5000 15.5000 15.5000 15.5000 15.5000 15.5000 15.5000 15.5000 11.0000 11.0000 11.0000 11.0000 11.0000 11.0000 11.0000 11.0000 6.5000 6.5000 6.5000 6.5000 6.5000 6.5000 6.5000 6.5000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 A3(:,:,2) = 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 A3(:,:,3) = 89.4100 97.3080 105.5733 114.2059 123.2059 132.5733 142.3080 152.4100 87.0025 94.9005 103.1658 111.7984 120.7984 130.1658 139.9005 150.0025 85.0000 92.8980 101.1633 109.7959 118.7959 128.1633 137.8980 148.0000 83.4025 91.3005 99.5658 108.1984 117.1984 126.5658 136.3005 146.4025 82.2100 90.1080 98.3733 107.0059 116.0059 125.3733 135.1080 145.2100 81.4225 89.3205 97.5858 106.2184 115.2184 124.5858 134.3205 144.4225 81.0400 88.9380 97.2033 105.8359 114.8359 124.2033 133.9380 144.0400
figure
surf(A3(:,:,1), A3(:,:,2), A3(:,:,3))
colormap(turbo)
xlabel('Lat')
ylabel('Lon')
zlabel('Wvel')
flipLatA3 = flip(A3,1)
flipLatA3 =
flipLatA3(:,:,1) = 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 6.5000 6.5000 6.5000 6.5000 6.5000 6.5000 6.5000 6.5000 11.0000 11.0000 11.0000 11.0000 11.0000 11.0000 11.0000 11.0000 15.5000 15.5000 15.5000 15.5000 15.5000 15.5000 15.5000 15.5000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 20.0000 24.5000 24.5000 24.5000 24.5000 24.5000 24.5000 24.5000 24.5000 29.0000 29.0000 29.0000 29.0000 29.0000 29.0000 29.0000 29.0000 flipLatA3(:,:,2) = 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 90.0000 94.2857 98.5714 102.8571 107.1429 111.4286 115.7143 120.0000 flipLatA3(:,:,3) = 81.0400 88.9380 97.2033 105.8359 114.8359 124.2033 133.9380 144.0400 81.4225 89.3205 97.5858 106.2184 115.2184 124.5858 134.3205 144.4225 82.2100 90.1080 98.3733 107.0059 116.0059 125.3733 135.1080 145.2100 83.4025 91.3005 99.5658 108.1984 117.1984 126.5658 136.3005 146.4025 85.0000 92.8980 101.1633 109.7959 118.7959 128.1633 137.8980 148.0000 87.0025 94.9005 103.1658 111.7984 120.7984 130.1658 139.9005 150.0025 89.4100 97.3080 105.5733 114.2059 123.2059 132.5733 142.3080 152.4100
figure
surf(flipLatA3(:,:,1), flipLatA3(:,:,2), flipLatA3(:,:,3))
colormap(turbo)
xlabel('Lat')
ylabel('Lon')
zlabel('Wvel')
.

Sign in to comment.

Categories

Find more on Geographic Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!