ITU_R p837-5- model on matlab

13 Ansichten (letzte 30 Tage)
Highzik
Highzik am 16 Nov. 2022
Bearbeitet: Walter Roberson am 11 Nov. 2024 um 20:48
I have this code of ITU-R p837-5 for rain rate extraction And i needed to enter my latitude, longitude and percentage of availability into the code to genrate a suitable data set for my location
how do i enter value of Lat, Lon, and p into this code
where my lat=7.17 , lon=5.18 and p = 10, 1, 0.3, 0.1, 0.03, 0.01, 0.003, 0.001,
I have attached the matlab code below
function [rr,p0] = itur_p837_5(p,lat,lon)
%-------------------------------------------------------------------------------------------------------------------
%
% function [rr,p0] = itur_p837_5(0.1,35.2,27.26)
%
% This function calculates the rainfall rate exceeded for p% of an average year,
% according to the prediction method defined in Recommendation ITU-R P.837-5 (Annex 1).
%
% France (G. Blarzino, N. Jeannin, L. Castanet), Italy (D. Ferraro, L. Luini, C. Capsoni), ESA (A. Martellucci) :
% “Discussion document about Recommendation ITU-R P.837-4”, Input document 3J/185-3M/217, 11 April 2007.
%
% Castanet L., Blarzino G., Jeannin N., Testoni A., Capsoni C., Ferraro D., Luini L.,
% Rogers D., Amaya C., Bouchard P., Pontes M., Sila-Mello L. :
% "Assessment of radiowave propagation for satellite communication and navigation systems
% in tropical and equatorial areas",
% Final Report ESA study n° ESTEC 18278/04/NL/US, Report ONERA RF 4/09521 DEMR, June 2007.
%
%
% Input parameters :
% p = probability level (%) (more than 1 level is possible ONLY if 1 location is desired)
% lat = latitude (deg)
% lon = longitude (deg)
% If rainfall rate is to be calculated at 1 specific location, bilinear interpolation
% (INTERP2.M) is used to obtain values at (lat,lon) coordinates specified in input.
% If a map of rainfall rate is to be calculated all over the world,
% DO NOT ENTER (lat,lon) coordinates as input.
%
% Output parameters :
% rr = rainfall rate exceeded for p% of an average year (mm/h)
% p0 = percentage probability of rain in an average year (%)
%
% Note :
% The function automatically loads meteorological input parameters required by
% Rec. ITU-R P.837-5 from the following files :
% ESARAIN_MT_v5.TXT : mean annual rainfall amount (mm)
% ESARAIN_BETA_v5.TXT : ratio of convective to total rainfall amount (-)
% ESARAIN_PR6_v5.TXT : probability of rainy 6-hours periods (%)
% ESARAIN_LAT_v5.TXT : latitudes of grid points (90:-1.125:-90) (deg)
% ESARAIN_LON_v5.TXT : longitudes of grid points (0:1.125:360) (deg)
%
% Called functions :
% No
%
% Necessary toolboxes :
% No
%
% by Giulio BLARZINO,
% ONERA, France
% Giulio.Blarzino@onera.fr
% Any questions : email <Laurent.Castanet@onera.fr> or <Antonio.Martellucci@esa.int>
%
% rel. 1.0
% release history:
% 0.0 (26/04/2007) - original version
% 1.0 (11/07/2007)
%
%-------------------------------------------------------------------------------------------------------------------
%
% load input meteorological paramaters
load ESARAIN_LAT_v5.TXT -ascii ; lat_e40 = ESARAIN_LAT_v5 ;
load ESARAIN_LON_v5.TXT -ascii ; lon_e40 = ESARAIN_LON_v5 ;
load ESARAIN_MT_v5.TXT -ascii ; mt = ESARAIN_MT_v5 ;
load ESARAIN_BETA_v5.TXT -ascii ; conv_ratio = ESARAIN_BETA_v5 ;
load ESARAIN_PR6_v5.TXT -ascii ; pr6 = ESARAIN_PR6_v5 ;
if nargin > 1
% convert longitudes to 0E .. 360E format
if lon < 0
lon = lon + 360;
end
% bi-linear interpolation of parameters @ the required coordinates
pr6i = interp2(lon_e40,lat_e40,pr6,lon,lat,'linear');
mti = interp2(lon_e40,lat_e40,mt,lon,lat,'linear');
betai = interp2(lon_e40,lat_e40,conv_ratio,lon,lat,'linear');
% extract mean annual rainfall amount of stratiform type
msi = mti.*(1 - betai);
% percentage probability of rain in an average year
p0 = pr6i.*(1 - exp(-0.0079.*(msi./pr6i)));
% calculate rainfall rate exceeded for p% of the average year
% for all the probability levels given in input
if isnan(p0)
p0 = 0;
rr = 0;
else
rr = zeros(size(p));
ix = find(p > p0);
if ~isempty(ix),
rr(ix) = 0;
end;
ix = find(p <= p0);
if ~isempty(ix),
a = 1.09;
b = mti./(21797.*p0);
c = 26.02.*b;
A = a.*b;
B = a + c.*log(p(ix)./p0);
C = log(p(ix)./p0);
rr(ix) = (-B + sqrt(B.^2 - 4*A.*C))./(2*A);
end
end
else
% extract mean annual rainfall amount of stratiform type
ms = mt.*(1 - conv_ratio);
% percentage probability of rain in an average year
p0 = pr6.*(1 - exp(-0.0079.*(ms./pr6)));
% calculate rainfall rate exceeded for p% of the average year
% for all the probability levels given in input
if isnan(p0)
p0 = 0;
rr = 0;
else
rr = zeros(size(mt));
if p > p0;
rr(:,:) = 0;
else
a = 1.09;
b = mt./(21797.*p0);
c = 26.02.*b;
A = a.*b;
B = a + c.*log(p./p0);
C = log(p./p0);
rr = (-B + sqrt(B.^2 - 4*A.*C))./(2*A);
end
end
end
return

Antworten (1)

Greg
Greg am 11 Nov. 2024 um 20:25
Thank you for sharing your question. To use the provided MATLAB function itur_p837_5 with your specific latitude, longitude, and percentage values, you'll need to call the function with these inputs in your MATLAB environment. First, ensure the data files are accessible and in the current working directory. Second, you will need to call the function with your specific values you specified. Include this code snippet in your code:
% Define your inputs
lat = 7.17;
lon = 5.18;
p = [10, 1, 0.3, 0.1, 0.03, 0.01, 0.003, 0.001];
% Call the function
[rr, p0] = itur_p837_5(p, lat, lon);
% Display the results
disp('Rainfall rates (mm/h) for given probabilities:');
disp(rr);
disp('Percentage probability of rain in an average year:');
disp(p0);
More details:
  • Latitude and Longitude: These are given as lat = 7.17 and lon = 5.18. The longitude is automatically adjusted within the function if it is negative, but in your case, it is already positive.
  • Percentages (p): These are the probabilities for which you want to calculate the rain rate. They are provided as a vector [10, 1, 0.3, 0.1, 0.03, 0.01, 0.003, 0.001].
  • Function Call: The function itur_p837_5 is called with p, lat, and lon as inputs, and it returns rr (rainfall rates) and p0 (percentage probability of rain in an average year).
Make sure that the MATLAB environment is set up correctly with all necessary files and paths. If you encounter any errors related to file loading, ensure the data files are in the correct location or adjust the paths accordingly.

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by