Climate Data Toolbox: how can i calculate correctly a trend with trend function?

조회 수: 59 (최근 30일)
Hi! I'm trying to apply the trend function presents in the Climate Data Toolbox for calculating sea level anomaly for the interval 1993-2020. The data matrix has dimension 720x1440x366 (lat,lon,time), where 336 are the months in the studied period. The matrix contains a lot of Nans in the third colmun, especially in the higher latitudes. Is it correct to apply the trend function as follows in order to correctly calculate the trend taking into account in the proper manner the Nans?
[matrix_trend,p] = trend (matrix, 336, 'omitnan');
Is this the way to calculate trend for a 3-D matrix along the time dimension, whose values are stored in the third column?
Moreover, is it ok to use the detrend3 function as follows to subtract the trend to the original data?
detrend = detrend3 (matrix, 'omitnan');
Or, otherwise, does exist a more efficient manner to obtain such a result, i.e.e the subtraction the trend from the reference data?
Thank you in advance.

채택된 답변

Chad Greene
Chad Greene 2021년 3월 25일
편집: Chad Greene 2021년 3월 25일
Hi Alessandro,
I think you've mostly got it. One key point to note is your sampling frequency is monthly, so 12 times per year. If you want the trend in units of sea level height per year, then the correct way to calculate it is:
[matrix_trend,p] = trend(matrix, 12, 'omitnan');
If you're trying to detrend the data, you've got it right, except I wouldn't use detrend as a variable name, because that might get confused with a function called detrend. It's probably better to do:
ssh_detrend = detrend3(ssh, 'omitnan');
Just one more note regarding your nans: I assume you have a lot of nans up north due to presence of sea ice and perhaps due to the orbital limit of whatever altimeters you're using. The 'omitnan' option should work properly, but when interpreting results, know that the results will represent the trend of the available data. So if a given grid cell only has data for the last ten years of the record, then the trend function will only tell you about the trend over the past ten years in that grid cell. This could potentially paint a picture of more extreme trends at the poles, in comparison to low-latitudes where data are available for the full record. But again, if the data span the full timespan of record but are just spotty due to perhaps an intermittent presence of sea ice, that should be alright.
  댓글 수: 2
Alessandro De Lorenzis
Alessandro De Lorenzis 2021년 3월 25일
Hi Chad,
Thank you very much for your fast and precise reply.
The goal of my analysis is to calculate the trend not per year but for the entire dataset in each cells of the grid, by taking into account all the data stored in each month. This is why I used 336 for the second parameter. Is it ok, then?
Yes, I changed the name of the variable for the detrend operation as you suggested.
As regards the NaN, the values are referrred to the northern regions, so I suppose that the detrend3 function is working properly.
Chad Greene
Chad Greene 2021년 3월 25일
Ah, sorry, I forgot to change your 366 to 12 when I posted it above. I've just now edited my answer to say 12 instead of 366.
The trend function gives you the slope of a least-squares fit to the change. The slope represents the average change in ssh over a given time period. So if your ssh values are in units of meters and you have monthly data, then trend(ssh,12) will give you units of meters per year. Multiply that by ten to get meters per decade.
If, however, you want the change in ssh over the entire record, then all you need is simple subtration, like this:
ssh_change = ssh(:,:,end) - ssh(:,:,1);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Climate Science and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by