%%
clear all
% Sample latitude and longitude data
ilat = 25*rand(1,50)+25;
ilon = 50*rand(1,50)-120;
% Sample data for color-coding the points
data = 10*rand(1,50);
close all
latlim=[min(ilat) ,max(ilat)];
lonlim=[min(ilon) , max(ilon)];
% find number of stations lat lon and number of data
h1 = figure(1);
ax = worldmap(latlim, lonlim);
states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
geoshow(ax, states, 'Facecolor', [1 1 0.9]);
hold on
map = colormap;
colorvector = map(1:64,:);
pmvect = linspace(0, max(data), 64);
for jj = 1:length(data)
%jj
colorb = interp1(pmvect, colorvector, data(jj));
plotm(ilat(jj),ilon(jj), data(jj),'o', 'MarkerEdgeColor','k','MarkerFaceColor', colorb, 'MarkerSize', 5);
hold on
end
caxis([0 max(data)])
colorbar
hold off
set(gcf,'Color','white')
usefulcodes.blogspot.com
Tuesday, March 21, 2023
Map with Latitudes and Longitudes, filled with shades
Friday, December 23, 2022
Plot netcdf data on map
close all clear all iwantFile ='ECMWF_utci_20201201_v1.1_con.nc' iT = double(ncread(iwantFile, 'utci')); iT2 = iT(:,:,20); iLon = double(ncread(iwantFile, 'lon')); iLat = double(ncread(iwantFile, 'lat')); load coastlines figure(1); imagesc('xdata', iLon, 'ydata', iLat , 'cdata', (iT2')); line(coastlon, coastlat, 'color', 'k') colorbar grid on; box on caxis auto set(gcf,'Color','white') xlim([-180 180]) ylim([-90 90])
Saturday, January 22, 2022
Combine PDFs in mac terminal
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=BindCoverAll.pdf Cover1.pdf Editorial_Cover_TOC.pdf JNPS732021_Combined.pdf
Thursday, November 19, 2020
Plotting NPP hdf data
filewant = 'cafe.2007001.hdf';
info = hdfinfo(filewant);
% This is how you can investigate the file structure...
info.SDS
%% note the names
info.SDS.Attributes.Name
%% note the values of the attributes
info.SDS.Attributes.Value
%% read the npp variable
npp = double(hdfread(filewant, 'npp' ));
npp(npp==-9999) = NaN;
% figure;
% imagesc(npp)
npp = flipud(npp); % because npp is flipped upside down wrt lat/lon for map
%%
iLat = linspace(-90,90,1080);
iLon = linspace(-180,180,2160);
[Lat, Lon] = ndgrid(iLat,iLon);
figure
load coastlines % coastineData.mat
latlim=[floor(min(min(Lat))),ceil(max(max(Lat))) ];
lonlim=[floor(min(min(Lon))),ceil(max(max(Lon))) ];
ax = worldmap(latlim, lonlim);
surfacem(Lat, Lon, npp);
geoshow(coastlat, coastlon,'Color', 'k' )
colormap; set(gcf,'Color','white')
colormap jet
map2 = colormap;
map2( 1, : ) = 1; colormap(map2);
colorbar
title('global dataset')
disp('Next we will try to crop out the area of interest')
%% This is an example of how to crop out to the area of interest...
iLat2 = linspace(-15,45,1080);
iLon2 = linspace(-90,0,2160);
[Lat2, Lon2] = ndgrid(iLat2,iLon2);
F = griddedInterpolant(Lat,Lon,npp); % read doc griddedInterpolant
npp_crop = F(Lat2,Lon2);
%
figure
load coastlines % coastineData.mat
latlim=[floor(min(min(Lat2))),ceil(max(max(Lat2))) ];
lonlim=[floor(min(min(Lon2))),ceil(max(max(Lon2))) ];
ax = worldmap(latlim, lonlim);
surfacem(Lat2, Lon2, npp_crop);
geoshow(coastlat, coastlon,'Color', 'k' )
colormap; set(gcf,'Color','white')
colormap jet
map2 = colormap;
map2( 1, : ) = 1; colormap(map2);
colorbar
title('NPP (mgC m-2 day-1)')
Alternative code that I have seen:
https://hdfeos.org/zoo/OTHER/npp_2010361_hdf.m
Monday, December 30, 2019
Alternating color in table conflicts with xcolor
My issue was trying to use the table with alternate color in a latex document with the termcal.
\usepackage[table]{xcolor} % loads also »colortbl«
\PassOptionsToPackage{table}{xcolor}
inserted before the\documentclass{..} fixed the issue!
Yes, Thanks to
https://tex.stackexchange.com/questions/5363/how-to-create-alternating-rows-in-a-table
Tuesday, January 1, 2019
DiskPart Recovering SD card
Tried installing Raspberian into 32 GB SD card. The file system went corrupt-somehow. Could not recover the other big part in windows because windows system.
The diskmanagement system showed the 30GB space in dark, which could not be accessed by simple formatting or change of the drive letter.
So, I had to go commando.
Went to the command mode.
Windows> CMD (admin mode)
Then executed the following codes...
Now I can see the whole SD card space!
diskpart
Microsoft DiskPart version 10.0.ccc
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: xxx
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 476 GB 0 B *
Disk 1 Online 476 GB 0 B *
Disk 2 Online 29 GB 26 GB
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> clean
DiskPart succeeded in cleaning the disk.
DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.
DISKPART> (then formatted the disk)