# Issue when projecting an array onto the fespace

**URL:** <https://community.freefem.org/t/issue-when-projecting-an-array-onto-the-fespace/298>\
**Category:** General Discussion\
**Created:** [March 10, 2020, 9:45am UTC](https://community.freefem.org/t/issue-when-projecting-an-array-onto-the-fespace/298 "2020-03-10T09:45:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mordokkai](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Mordokkai](https://community.freefem.org/u/Mordokkai)\
**Post date:** [March 10, 2020, 9:45am UTC](https://community.freefem.org/t/issue-when-projecting-an-array-onto-the-fespace/298/1 "2020-03-10T09:45:14Z")

</div>

Hi,

Let’s say I have a 2D array stored in a file:  
import matplotlib.pyplot as plt  
import numpy as np  
a = np.loadtxt(“w\_map.txt”)  
a = np.reshape(a,(624,304))  
plt.imshow(a)  
plt.show()

![img1](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/f150a5bb14c6269f38aa827f86341692bedb4cec.png)

Then I want to use this 2D function in FreeFem++:

// READ THE MAP  
ifstream wmap(“w\_map.txt”);  
real[int, int] w(624, 304);

for(int i=0; i\<624; i++){  
for(int j=0; j\<304; j++){  
string comment;  
if ( !wmap.good() )  
break;  
getline(wmap, comment);  
w(i,j) =atof(comment);  
}  
}

// CREATE THE FESPACE (just a rectangle)  
border a(t=0, dims[0]){x=t; y=0; label=1;};  
border b(t=0, dims[1]){x=624; y=t; label=2;};  
border f(t=0, dims[0]){x=624-t; y=304; label=3;};  
border d(t=0, dims[1]){x=0; y=304-t; label=4;};

int n=240;  
mesh fm = buildmesh(a(n) + b(n) + f(n) + d(n));  
fespace Vh(fm, P1);

Vh whh = w;  
plot(whh, wait=true);

 ![img2](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/d3e7b6a489cbb4f6c180988b477e4fead2f112dc.png)

It looks like the projection of my 2D function onto the fespace is wrong but I dont know why.  
Do you have any idea where the problem comes from ?

PS: Do you know how to do the Tab cause it’s really annoying to have non indented code in my posts.
