how to take out extreme event annually from the data.

2 visualizaciones (últimos 30 días)
ravi
ravi el 17 de Abr. de 2014
Comentada: Star Strider el 25 de Abr. de 2014
sir i have program who calculate extreme event annually for whole 95 years but this program works only for those who does not include leap years it means data size is 20x22x34675(lon,lat,time)(365*95) but i want to calculate extreme event annually for those data who include leap years (it mean 365 Or 366 then 365 Or 366 ....each separate years) then what will be change in this program for doing this? my data size is (prec_all_years) 20x22x34698(lon,lat,time)(365*95+23).this is daily data.please help me sir.thank you.
prec_all_years = prec_all_years*86400; % rainfall in mm/day
bins = [64.5 124.5 244.5 Inf];
% Reshape into lat/lon/day/year, and bin over 3rd dimension (days)
counts = histc(reshape(prec_all_years,20,22,365,95),bins,3);
% Extract the counts for each of the 3 categories
hr = squeeze(counts(: , : , 1 , : ));
vhr = squeeze(counts(: , : , 2 , : ));
ehr = squeeze(counts(: , : , 3 , : ));
% Extract a region
xe = 13:20; ye = 11:16;% xe is x for east,ye is y for east
% Extract counts for each category
count_hr_east = sum(reshape(hr(xe , ye , : ) , [] , 95 ));
count_vhr_east = sum(reshape(vhr(xe , ye , : ) , [] , 95 ));
count_ehr_east = sum(reshape(ehr(xe , ye , : ) , [] , 95 ));

Respuesta aceptada

dpb
dpb el 17 de Abr. de 2014
Editada: dpb el 20 de Abr. de 2014
I really, Really, REALLY wish you'd quit this incessant creation of new threads and just carry on a linear conversation...I'm thinking this is about the last shot you've got with me, any way.
OK, Ravi, let's try this an entirely different way -- instead of the complexity of the reshape over multiple dimensions that you just don't seem to be grasping the basics of, let's just go back to brute force and stubborness and maybe you can at least then get to an answer, letting code refinement come later...
IIUC, you've a 3D data set of precipitation predictions on a daily basis for a 2D matrix of geographical locations with the 3rd dimension representing each day over a period of years. Your present objective is to return the maximum predicted rainfall for each year by year over the entire time period.
In our previous thread on data selection, we agreed that there is a corollary vector of time data that can be generated as
dn = datenum([2006 1 1 ;2100 12 31]); % Matlab datenum corresponding to planes
Y = datevec(dn); % the year of each of the above
ERRATUM:
Y = datevec(dn); % the year of each of the above
should be
[Y,~] = datevec([dn(1):dn(2)]);
--dpb
So, given that, to find the maximum for each year by year is easy enough...
max_precip=zeros(size(precip,1),size(precip,2),Y(end)-Y(1)+1,1); % preallocate
iyr=0; % counter for the array
for yr=Y(1):Y(end) % loop over all the years in range
iyr=iyr+1; % increment the counter
max_precip(:,:,iyr)=max(precip(:,:,yr==Y),3); % max over the years
end
Now you'll have a lat x lon x 95 array of the yearly maxima each plane being the max for each year in the dataset at each point. You can simply modify the two lat/lon indices to select various regions rather than globally.
ADDENDUM:
I did think about the dataset option a little -- it's possible but would require duplicating a lot of data to convert the 3D storage to 2D as the dataset object isn't quite as flexible as I was hoping perhaps it might be.
  27 comentarios
ravi
ravi el 25 de Abr. de 2014
Again thank you so much dpb sir for your support.you are very nice person,thank you so much sir.
Star Strider
Star Strider el 25 de Abr. de 2014
dpb NOW I remember!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Calendar en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by