# Projecting and interpolating data to a regular grid

**URL:** <https://discourse.julialang.org/t/projecting-and-interpolating-data-to-a-regular-grid/56162>\
**Category:** Geo\
**Tags:** interpolations, gmt, geodesy\
**Created:** [February 27, 2021, 10:38pm UTC](https://discourse.julialang.org/t/projecting-and-interpolating-data-to-a-regular-grid/56162 "2021-02-27T22:38:41Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [February 28, 2021, 11:04pm UTC](https://discourse.julialang.org/t/projecting-and-interpolating-data-to-a-regular-grid/56162/9 "2021-02-28T23:04:44Z")

</div>

OK, a full GMT example

```julia
# Extract a sub-region from a global grid. Using a low resolution to keep example light
Ggeog = grdcut("@earth_relief_10m", region=(-18,15,32,56));

```

convert to Lambert

```julia
Glamb = grdproject(Ggeog,proj="+proj=lcc+lat_1=39+lat_2=50+lat_0=45+lon_0=0");

```

Show them. Rafael, you are right about the extrapolation but the trick is to not do it and instead fill those nodes with NaNs.

```julia
imshow(Ggeog, shade=true, cmap=:geo, name="geogs.png")
imshow(Glamb, shade=true, cmap=:geo, name="lcc.png")

```

 ![geogs](https://global.discourse-cdn.com/julialang/original/3X/6/a/6a1f7f369ac21f9537a19e0d2f48900e29f17416.png)  
 ![lcc](https://global.discourse-cdn.com/julialang/original/3X/f/2/f2f48dab880845236657b72d7fa95613cdd3c9bf.png)

---

_[View the full topic](https://discourse.julialang.org/t/projecting-and-interpolating-data-to-a-regular-grid/56162)._
