Thursday, December 4, 2014

Latitude Longitude and Data on Map @matlab

I wanted to have a nice map of the global dataset given the lat/lon and the dataset.
This code is being put here so that it could be used later.
boxmap = 0
% close all

latlim = [-90, 90];
lonlim = [-180, 180];
load coast
figure

if boxmap
    axesm('MapProjection','lambcyln','grid','on', ...
        'MapLatLimit',latlim,'MapLonLimit',lonlim,...
        'MLineLocation',15, 'PLineLocation',15)
else
    ax = worldmap(latlim, lonlim);
 
end
geoshow(lat, long,'Color', 'black' )
set(gcf,'Color','white')

for jj = 1:length(cimms)
   
    [SunRiseSet,Day,Dec,Alt,Azm,Rad] = suncycle( latitude(jj) , longitude(jj) , [Uyear(jj) Umo(jj) Uday(jj)] , 2880 );
 
    if SunRiseSet(2)<SunRiseSet(1)
        SunRiseSet(2) = SunRiseSet(2)+24;
    end
 
    if Uhr(jj)>SunRiseSet(1) & Uhr(jj)<SunRiseSet(2)
        plotm(latitude(jj),longitude(jj), jj,'o', 'MarkerEdgeColor','r','MarkerSize',8);
     
        dayyes(jj) = 1;
    else
        plotm(latitude(jj),longitude(jj), jj,'o', 'MarkerEdgeColor','b','MarkerSize',8);
     
        dayyes(jj) = 0;
     
    end
 
    hold on
 
    if rem(jj,1000)==0
        textm(latitude(jj),longitude(jj),  sprintf('%.1d', jj), 'color', 'g')
     
        pause(0.5)
     
    end
 
 
end

No comments: