Using MATLAB to find multi-day 90th percentile temperature exceedences -


i working on project i'm trying find multi-day events temperature exceeds 90th percentile.

i'm using 61 years of data , trying calculate percentiles based on each month between june-august. in other words, using prctile function, calculate 90th percentile june, july, , august , compare each month's daily temperature values based on 90th percentile value month.

ultimately, want program find strings of days (2-day, 3-day, 4-day, 5-day, etc.) temperature exceeds 90th percentile value, based on month's value.

below code have far:

fprintf('loading data...\n')     load file_name.txt     year=file_name(:,1);     month=file_name(:,2);     day=file_name(:,3);     temax=file_name(:,6);     temin=file_name(:,9);      molen=[30 31 31];      y=1:61         m=6:8             k=1:molen                 g1=find(year==y+1950&month==m&day==k&temax>-99);                 g2=find(year==y+1950&month==m&day==k&temin>-99);             end             temaxpct=prctile(temax(g1),90);             teminpct=prctile(temin(g2),90);         end         clear g*     end     exceedence=find(year&month&day&temax>=temaxpct&temin>=teminpct);  

i don't know how make program calculate 90th percentile each month (instead of whole 3-month range june-august).

additionally, don't know how make program find strings of days temperature exceeds 90th percentile, especially, since 4-day events include 3-day events , 2-day events.

i know there needs if/else statements, i'm not sure how set up.

just reading question (without digging through code), here 2 pointers:

  1. if know how percentiles dataset, can loop on months each time giving function data month. calculate , store quantile month.
  2. if know how find n-day stretches temperature above treshold, here rather un-elegant way find stretches:
    • find stretches of maximum length, mark found values done
    • find stretches of maximum length - 1, using unmarked values, mark found values done
    • continue till reach minimum

hope can on track.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -