Issue overlaying contour on Usa background

2 次查看(过去 30 天)
Hello, I'm trying overlay a contour image on Usa background The issue I'm having is that I can produce the images("First" and "second") separately, but once I try to overlay the contour "First" onto the background image "second". It over lays "First" and I'm left with "second"
The file is a netcdf file from the HRRRe model.
close all;
clear all;
%%Add Paths for NCtoolbox
addpath('C:\Users\agoenner\Desktop\nctoolbox-1.1.3') %add the path to nctoolbox
run('setup_nctoolbox.m'); % starts up the nctoolbox to use in script
ncdisp('C:\Users\agoenner\Desktop\HRRRe in Netcdf only POP\test2.nc'); %displays the information in the file
nc = ncgeodataset('C:\Users\agoenner\Desktop\HRRRe in Netcdf only POP\test2.nc'); %grabs the geo data and store it in
a variable
nc.variables; %finds the variables in file
nc.size('APCP_GT_12_7_surface'); %determines the size of the matrix
POP = nc.geovariable('APCP_GT_12_7_surface'); %asigns the lat and lon to a variable
nc.dimensions('APCP_GT_12_7_surface'); % determines the dimensions of the matrix (x,y, time)
rain = POP.data(1,:,:); % grabs only the POP values from the POP data
rain = squeeze(double(rain)); %condense the POP values down
POP_coords =POP.grid_interop(1,:,:);
%%Finds the boundaries of the domain
latmax = max(max(POP_coords.lat));
latmin = min(min(POP_coords.lat));
lonmax = max(max(POP_coords.lon));
lonmin = min(min(POP_coords.lon));
%%Plots the POP value
ax = usamap([latmin latmax],[lonmin lonmax]); %Places the boundaries of the plot
states = shaperead('usastatehi', 'UseGeoCoords', true); %Generates the states outlines
geoshow(ax, states, 'FaceColor', 'none'); %Make the plot of the states inside the boundaries and colors them white
axesm lambert %Makes the map projection lambert
hold on
contour(POP_coords.lon, POP_coords.lat, rain, 10,'ShowText','on'); %Contours the POP data on the coords every 10%
colormap(winter)
If you have other ideas on how to product the image I'm willing to try different ideas.

回答(1 个)

Chad Greene
Chad Greene 2017-8-10
I think you want
contourm(POP_coords.lat, POP_coords.lon, rain, 10)
  2 个评论
Andrew Goenner
Andrew Goenner 2017-8-10
I just try contourm and I received the only the second image(Usa background) as the output.
Chad Greene
Chad Greene 2017-8-10
Did you get the order of lat and lon correct? Do the sizes of the lat and lon matrices match the size of the rain matrix?

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by