How to read the rainfall data format attached in the file and obtain the monthly, annual daily and hourly maximum values? Kindly help me with this

1 visualización (últimos 30 días)
I need to read the data and obtain the monthly, annual, daily and hourly maximum values.
I used readtable to import the data. Have difficulty reading the time format.

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 23 de Abr. de 2021
Editada: Cris LaPierre el 23 de Abr. de 2021
Once you get the data to import correctly (see datetime for time formatting options), I think you want to use groupsummary. Use the following syntax
and set the groupbin input to be your desired time increment (see options here)
% Set up import settings
opts = detectImportOptions("rainfall_data.xlsx");
opts = setvartype(opts,"Var1","datetime");
opts = setvaropts(opts,"Var1",'InputFormat','yyyyMMdd HH:mm');
% import data
data = readtable('rainfall_data.xlsx',opts)
data = 99454×2 table
Var1 Var2 ______________ _____ 19480701 01:00 0 19480701 13:00 25400 19480702 00:00 25400 19480801 01:00 0 19480801 13:00 25400 19480802 00:00 25400 19480901 01:00 0 19480901 13:00 25400 19480902 00:00 25400 19481001 01:00 0 19481001 13:00 25400 19481002 00:00 25400 19481017 08:00 1.27 19481017 09:00 1.27 19481017 17:00 0.25 19481017 20:00 1.02
% Determine max rainfal by year
yrMaxRain = groupsummary(data,"Var1","year","max")
yrMaxRain = 66×3 table
year_Var1 GroupCount max_Var2 _________ __________ ________ 1948 582 25400 1949 1476 25400 1950 1622 25400 1951 1742 25400 1952 1635 25400 1953 1143 25400 1954 1516 25400 1955 1524 25400 1956 982 25400 1957 1738 25400 1958 1382 25400 1959 1390 25400 1960 1389 25400 1961 1418 25400 1962 1407 25400 1963 1425 25400

Más respuestas (1)

MEGHANA N
MEGHANA N el 23 de Abr. de 2021
Thanks a lot!

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by