arrays - Incompatible ranks 0 and 2 in assignment at (1) -


i cannot head around arrays , scalars in gfortran. when trying run these 3 equations

real(8), dimension(1:ni, 1:nj) :: slope_rad, aspect_rad  real(8) :: clearsky,theta,theta_pyrstat, &     transmissivity,i0,pressure  real(8), dimension(runl) :: solarzenithanglecorr_rad, &                        solarazimuthangle_rad, rm_r2, press_in, hillshade, p  theta = acos(cos(slope_rad)) *cos(solarzenithanglecorr_rad(t)) &              +sin(slope_rad)*sin(solarzenithanglecorr_rad(t)) &              *cos(solarazimuthangle_rad(t)-aspect_rad)             clearsky = i0*rm_r2(t)*transmissivity**(p/(press_in(t)*cos(solarzenithanglecorr_rad(t))))*cos(theta);  hillshade(t) = 255*((cos(solarzenithanglecorr_rad(t))*cos(slope_rad)) &             +(sin(solarzenithanglecorr_rad(t)) * sin(slope_rad)) &             *cos(solarazimuthangle_rad(t) - aspect_rad)) 

i'm getting following errors

main.f90:406:3:  theta = acos(cos(slope_rad)) *cos(solarzenithanglecorr_rad(t)) &  

1 error: incompatible ranks 0 , 2 in assignment @ (1) main.f90:411:3:

clearsky = i0*rm_r2(t)*transmissivity**(p/(press_in(t)*cos(solarzenithanglecorr_rad(t))))*cos(theta); 

1 error: incompatible ranks 0 , 1 in assignment @ (1) main.f90:417:3:

hillshade(t) = 255*((cos(solarzenithanglecorr_rad(t))*cos(slope_rad)) & 

1 error: incompatible ranks 0 , 2 in assignment @ (1)

your slope_rad array. therefore cos(slope_rad) still array. cannot assign array scalar theta.

first decide slope_rad means, if should array or scalar, value means , study what

theta = acos(cos(slope_rad)) *cos(solarzenithanglecorr_rad(t)) &              +sin(slope_rad)*sin(solarzenithanglecorr_rad(t)) &              *cos(solarazimuthangle_rad(t)-aspect_rad)    

should mean.

as stevees noted, acos(cos(slope_rad)) strange thing use anyway, whatever slope_rad is.


Comments