# Plot geo-map for MITgcm grid

**URL:** <https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173>\
**Category:** Q&A\
**Created:** [August 2, 2022, 2:42am UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173 "2022-08-02T02:42:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangleir](https://avatars.discourse-cdn.com/v4/letter/y/a8b319/32.png) [@yangleir](https://forum.generic-mapping-tools.org/u/yangleir)\
**Post date:** [August 2, 2022, 2:42am UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173/1 "2022-08-02T02:42:43Z")

</div>

Hi, everyone

I try to plot the geographic map for the MITgcm model which has complex grid difficult to project on map.

More information could be found here:  
[https://medium.com/pangeo/petabytes-of-ocean-data-part-1-nasa-ecco-data-portal-81e3c5e077be](https://medium.com/pangeo/petabytes-of-ocean-data-part-1-nasa-ecco-data-portal-81e3c5e077be)

> The model grid itself is a complex l[at-lon-cap (LLC) curvilinear grid](https://ecco.jpl.nasa.gov/products/latest/user-guide/) which is difficult to visualize in a regular map projections.

I just download the data and its’ structure seems:

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/d/d95b9f9f37a0ee7f613ce793178d3f65f65fc9d4.png)

You can see that the data have `latitude` and `longitude` as the 2D variables instead of 1D dimensions.

The data could be shown using `JX` projection:

```auto
gmt begin Aghulhas png
	gmt set MAP_ANNOT_OBLIQUE 0
	gmt grd2cpt myfile3.nc?Theta -Cjet -Z
	gmt grdimage myfile3.nc?Theta -I+a90 -R1000/2000/2500/3500 -JX15/13c -B100 
	gmt colorbar -DJRM+o1.c/0+mc -I0.3 -Bx2+lTheta -By+ldegree
gmt end show 

```

 ![Aghulhas](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/3/3c65d066e3db6afede1e5090ef2a8ef59fa5da2c.jpeg)

So, is it possible to plot geo-map for this kind of data?  
Dose anyone have suggestions for this question?

Thanks

Lei

---

<div class="post-metadata">

**Author:** ![yangleir](https://avatars.discourse-cdn.com/v4/letter/y/a8b319/32.png) [@yangleir](https://forum.generic-mapping-tools.org/u/yangleir)\
**Post date:** [August 2, 2022, 2:04pm UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173/2 "2022-08-02T14:04:43Z")

</div>

I crop a small file (LLC4320). Anyone who interests this question could find the data here: [https://www.jianguoyun.com/p/DYpRAn0Q2PCQBxijq9AEIAA](https://www.jianguoyun.com/p/DYpRAn0Q2PCQBxijq9AEIAA)

Please trying this code:

```auto
gmt begin Aghulhas2 png
	gmt set MAP_ANNOT_OBLIQUE 0
	gmt grd2cpt myfile_sa.nc?Theta -Cjet -Z
	gmt grdimage myfile_sa.nc?Theta -I+a90 -R2000/4500/5000/6500 -JX7/5c -B500 
	gmt colorbar -DJRM+o0.5c/0+mc -Bx5+lTheta -By+ldegree
gmt end show 

```

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [August 2, 2022, 11:07pm UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173/3 "2022-08-02T23:07:32Z")

</div>

This is a recurrent question. My answer to it is: use the Julia package “RemoteS” that has a function to solve exactly these cases.

---

<div class="post-metadata">

**Author:** ![yangleir](https://avatars.discourse-cdn.com/v4/letter/y/a8b319/32.png) [@yangleir](https://forum.generic-mapping-tools.org/u/yangleir)\
**Post date:** [August 3, 2022, 3:56am UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173/4 "2022-08-03T03:56:43Z")

</div>

Thanks Joaquim.  
I installed the Julia GMT and RemoteS. Good tools. I find you shared one good example:[https://www.generic-mapping-tools.org/RemoteS.jl/dev/gallery/Aqua\_sst/remotes\_L2\_SST/](https://www.generic-mapping-tools.org/RemoteS.jl/dev/gallery/Aqua_sst/remotes_L2_SST/)

It is similar to the LLC data structure. I will give a try based on this example.

Lei

---

<div class="post-metadata">

**Author:** ![yangleir](https://avatars.discourse-cdn.com/v4/letter/y/a8b319/32.png) [@yangleir](https://forum.generic-mapping-tools.org/u/yangleir)\
**Post date:** [August 3, 2022, 4:11am UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173/5 "2022-08-03T04:11:55Z")

</div>

![GMTjl_tmp](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/1/158b4f661c55fc942a316cc39dd5182e2d3a7de7.png)

```auto
G = grid_at_sensor("./myfile5.nc", "Theta",region=(10,40,-50,-10), inc=0.03);
imshow(G, proj=:guess, coast=true, dpi=200)

```

Really cool tools. Only two lines.

But I have another simple question: where or how dose Julia GMT save the figure?

Another suggestion:  
The `RemoteS` seems only know the `variable name` as `latitude or longitude`, but does not check the `long name` or `standard name`. Just like the data I shared, the `variable name`: `XC YC` stands for `latitude and longitude` and they are presented in the `long name` or `standard name`. So it fails to use it directly.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [August 3, 2022, 8:30am UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173/6 "2022-08-03T08:30:00Z")

</div>

Use figname=newname.png option

See the function online help. I must have accounted for those cases. Otherwise please open an issue.

Sorry for these short answers but I’m somewhere in an island with no computer with me.

---

<div class="post-metadata">

**Author:** ![yangleir](https://avatars.discourse-cdn.com/v4/letter/y/a8b319/32.png) [@yangleir](https://forum.generic-mapping-tools.org/u/yangleir)\
**Post date:** [August 3, 2022, 9:19am UTC](https://forum.generic-mapping-tools.org/t/plot-geo-map-for-mitgcm-grid/3173/7 "2022-08-03T09:19:34Z")

</div>

Thanks.  
I missed the online documents. It was already mentioned and fixed my question.  
Now, it is very nice.

```auto
G = grid_at_sensor("./myfile4.nc", "Theta",region=(0,50,-50,-10),xarray="XC", yarray="YC", inc=0.03);

```
