title: Fortran "Error: Incompatible ranks 0 and 1 in assignment"
body: <p>I'm writing a linear inverse program using geophysical data. I'm new to programming in Fortran although I have created programs relating to geophysical problems with Fortran before. </p>
  
  <p>I'm encountering the error : "Error: Incompatible ranks 0 and 1 in assignment" when compiling. I know this has to do with lengths not agreeing, but I have been unable to resolve it. I want to assign the row of Prism_r(i,pp) with the values previously calculated, namely r1-r4. The error is as followed:    </p>
  
  <pre><code>Prism_r(i,pp)=(/ r1(pp),r2(pp),r3(pp),r4(pp) /)                 
      1
  Error: Incompatible ranks 0 and 1 in assignment at (1) 
  </code></pre>
  
  <p>Here is the relevant code:</p>
  
  <pre><code>real, dimension(0:P-1) :: r1, r2, r3, r4    
  real, dimension(0:D-1,0:3) ::Prism_r, Prism_theta
  .....
  do i=0,D-1
      do pp=0,P-1
      r1(pp)=sqrt((x2+2*PP-0.2*i)**2+z1**2)
      r2(pp)=sqrt((x2+2*PP-0.2*i)**2+z2**2)
      r3(pp)=sqrt((x1+2*PP-0.2*i)**2+z2**2)
      r4(pp)=sqrt((x1+2*PP-0.2*i)**2+z1**2)
      Prism_r(i,pp)=(/ r1(pp),r2(pp),r3(pp),r4(pp) /)
      enddo  
  enddo
  </code></pre>
  
  <p>The calculations are being performed correctly when I comment Prism_r out, but it will not assign values to it. Does anyone have advice to how I need to correctly define r1-r4 so their values will be assigned to Prism_r?</p>