surfacem - how to show partial cells

Hi,
If I do
A = rand(3,3);
lat = [46 46.1 46.2; 42 42.1 42.2; 38 38.1 38.2];
lon = [10 11 12; 10.2 11.2 12.2; 10.4 11.4 12.4];
clf; axesm('MapProjection','eqdconicstd','MapLatLimit',[37.9 46.3]);
surfacem(lat,lon,A);
I will get 4 cells. But if I change the MapLatLimits to [37.9 46.1]:
clf; axesm('MapProjection','eqdconicstd','MapLatLimit',[37.9 46.1]);
surfacem(lat,lon,A);
The top right cell is missing because it is not fully within the lat/lon limits. How can I show cells/values that are only partially within the lat/lon limits in a map plot using surfacem/pcolorm etc?
Thanks, Fredrik, using R2015b

 Réponse acceptée

Fredrik
Fredrik le 29 Nov 2016

0 votes

The solution I went with was to find the corners of each grid cell and then do a fillm for each gridpoint separately in a nested loop. It took 1 hour to run the loops but the result is exactly what I was looking for.

Plus de réponses (1)

KSSV
KSSV le 25 Nov 2016
A = rand(3,3);
lat = [46 46.1 46.2; 42 42.1 42.2; 38 38.1 38.2];
lon = [10 11 12; 10.2 11.2 12.2; 10.4 11.4 12.4];
clf; axesm('MapProjection','eqdconicstd',......
'MapLatLimit',[min(lat(:)) max(lat(:))],'MapLonLimit',[min(lon(:)) max(lon(:))]);
surfacem(lat,lon,A);

5 commentaires

Fredrik
Fredrik le 25 Nov 2016
Thank you for your answer but I don't want to change my lat/lon limits. They should, in the example given, be [37.9 46.1] but I want to show the part of the "northeast" cell that is inside the frame.
KSSV
KSSV le 25 Nov 2016
Can you show a figure you want?
Fredrik
Fredrik le 29 Nov 2016
Hi,
I totally missed your second reply. I have attached a figure (hopefully). Look at the sea (dark blue) to the left in each panel. I want to display the grid cells that only partially come within the frame so that I do not have white areas to the left in each panel.
Fredrik
KSSV
KSSV le 29 Nov 2016
If this is the case, you have to pick only sea related coordinates and use surfm. There must be an option in the tool box to plot only sea or only land etc.
Fredrik
Fredrik le 29 Nov 2016
surfacem and surfm give the same result, i.e. not the way I want it. Also, I want all grid points (land, sea, ... ) to be shown the same way. I just gave the blue cells as an example.

Connectez-vous pour commenter.

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by