# Any way to populate a grid from input vectors?

**URL:** <https://discourse.julialang.org/t/any-way-to-populate-a-grid-from-input-vectors/95410>\
**Category:** General Usage\
**Tags:** matlab, function\
**Created:** [March 1, 2023, 9:52pm UTC](https://discourse.julialang.org/t/any-way-to-populate-a-grid-from-input-vectors/95410 "2023-03-01T21:52:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![albrightand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albrightand/32/38684_2.png) [@albrightand](https://discourse.julialang.org/u/albrightand)\
**Post date:** [March 1, 2023, 9:52pm UTC](https://discourse.julialang.org/t/any-way-to-populate-a-grid-from-input-vectors/95410/1 "2023-03-01T21:52:29Z")

</div>

Is there any existing package to take two input vectors and create a grid (similar to meshgrid) and then output a raster based on a third dimension? Something that recreates roundgridfun.m in Matlab.

> <https://github.com/hokiespurs/general-purpose-matlab/blob/master/gridding/roundgridfun/roundgridfun.m>

---

<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:** [March 1, 2023, 11:03pm UTC](https://discourse.julialang.org/t/any-way-to-populate-a-grid-from-input-vectors/95410/2 "2023-03-01T23:03:03Z")

</div>

Well, GMT.jl has these guys (all 2D gridders)

- [Nearneighbor](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/nearneighbor/)

- [Delaunay triangulation](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/triangulate/)

- [Minimum curvature](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/surface/)

- [Min/max/std/countings/etc… bin gridders](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/blockmean/index.html#blockmean)

- [Reformater of previously gridded data](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/xyz2grd/)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 2, 2023, 1:43am UTC](https://discourse.julialang.org/t/any-way-to-populate-a-grid-from-input-vectors/95410/3 "2023-03-02T01:43:05Z")

</div>

> [@albrightand](#):
>
> Is there any existing package to take two input vectors and create a grid (similar to meshgrid)

If you google “meshgrid Julia”, this comes up as the first link: [Meshgrid function in Julia](https://discourse.julialang.org/t/meshgrid-function-in-julia/48679)

TLDR: yes, there are plenty of examples of `meshgrid` routines in Julia, e.g. [here](https://github.com/ChrisRackauckas/VectorizedRoutines.jl/blob/c9e4f90ff1c083da5abfc5fc5006b188b1cac69c/src/matlab.jl#L50-L55) or better yet [LazyGrids.jl](https://github.com/JuliaArrays/LazyGrids.jl), but people generally learn to use broadcasting instead.

---

<div class="post-metadata">

**Author:** ![albrightand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albrightand/32/38684_2.png) [@albrightand](https://discourse.julialang.org/u/albrightand)\
**Post date:** [March 2, 2023, 3:42pm UTC](https://discourse.julialang.org/t/any-way-to-populate-a-grid-from-input-vectors/95410/4 "2023-03-02T15:42:31Z")

</div>

joa-quim,

I think the bin gridders function is what I’m looking for. I was hoping GMT would already have some kind of function for that. Thanks for the assist. I’ll post my code once I figure how to get it working.
