Monthly Percentiles Atmospheric Data

2 views (last 30 days)
Zach
Zach on 8 Aug 2013
Hello All,
I am trying to find the most efficient way to write a chunk of code which calculates 5-95th percentiles for each month of each year over a 60-year period. For example, calculating the percentiles for temperature for January 1970 using daily data. I want to end up with an array that looks something like this:
Year Month 5th Percentile 10th Percentile 15th Percentile...95th Percentile
1970 1 -2 0 1.5
1970 2 -0.5 1.2 2.4
1970 3 etc...
So I would have year, month, and 20 columns of percentiles. What would be the most efficient way to set this up?
Thanks,
Zach

Answers (1)

per isakson
per isakson on 8 Aug 2013
If you have the Statistics Toolbox, search for
prctile
  2 Comments
Zach
Zach on 8 Aug 2013
Thank you for your response. I am familiar with the prctile function. What I am trying to do is apply the percentile function to atmospheric variable for each month of each year and have the program write out the percentiles for each month of each year. So for example, what are the percentiles for a variable for January of 1970, February of 1970, March of 1970, so on and so forth for each year (1971, 1972, etc.). I want the program to print out a column for the year, a column for the month, and a column for each percentile (in increments of 5 from the 5-95th) for each month of each year:
Year Month 5th 10th 15th 20th 25th....95th
1970 1 -0.5 0.9 1.7 2.6 3.8 etc.
1970 2 1 2.2 3.9 5.1 6.2 etc.
...
1971 1 -0.3 1 1.5 2.8 3.9 etc.
1971 2 etc..
I'm using daily data to calculate the percentiles. Does this make sense? So I should have a column for year and month (12 months in a year) and 20 columns of percentiles (5-95th) that correspond to each month of each year.
Thanks,
Z
per isakson
per isakson on 8 Aug 2013
You ask two things:
  • "Does this make sense? So I should have a column for year[...]"
  • "most efficient way to write a chunk of code"
Yes, that makes sense. The format of the table should make it easy for the user to read it. I would not like to read the table you propose. How many years?
The design of the function depends on the format of the input data and the format of the table.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!