Saturday, January 22, 2022

Combine PDFs in mac terminal

Combine PDF

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

A sample code to plot the NPP data
The data source: 

 filewant = 'cafe.2007001.hdf';


info = hdfinfo(filewant);


% This is how you can investigate the file structure...


%% note the names


%% note the values of the attributes


%% 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);



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);



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);





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);


title('NPP (mgC m-2 day-1)')

Alternative code that I have seen:


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«

There were conflicts.

\PassOptionsToPackage{table}{xcolor} inserted before the \documentclass{..} fixed the issue!

Yes, Thanks to

Tuesday, January 1, 2019

DiskPart Recovering SD card

My problem:
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!


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 succeeded in cleaning the disk.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> (then formatted the disk)

Friday, September 1, 2017

Change Printers Default Single Sided Setting #mac

 Well, there is an easy way...
This prompted me to do
cupsctl WebInterface=yes
to the terminal... which enabled opening up the printer options... then I could set up the duplex printing.
Went to
Then, I had to select "Two-sided, Long-edge binding".

This enabled printing on both sides.

Friday, July 21, 2017

Plot USA m_maps

  close all
 load coastlines
states = shaperead('usastatehi',...
        'UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
m_proj('miller','long',[-125 -67],'lat',[25 49.5]);
% m_gshhs_i('color','b');
% m_grid('box','fancy','tickdir','in');
m_coord('geographic');           % Switch to assuming geographic
% m_coast('patch',[1 1 0.99],'edgecolor','b');
  m_coast('patch',[.98 0.98 .98],'edgecolor','none');
    m_grid('box','fancy','linestyle','none','backcolor',[.8 .96 1]);
m_text(-121,38.08,  '*' ,'color','r','fontweight','bold','fontsize',24); % Tahoe
m_text(-116.8,33.03,  '*' ,'color','r','fontweight','bold','fontsize',24); % salton Sea

m_text( -77.8729,40.2547,  '*' ,'color','r','fontweight','bold','fontsize',24); % PSU
m_text( -89.9729,33.9,  '*' ,'color','r','fontweight','bold','fontsize',24); % GWN
m_text(-97.62,43.3,  '*' ,'color','r','fontweight','bold','fontsize',24); % SXF
m_text(-89.37,40.,  '*' ,'color','r','fontweight','bold','fontsize',24); % BND

for kk = 1:length(states)
m_line(states(kk).Lon,states(kk).Lat,'linewi',0.5,'color',[200 200 200]./255);

export_fig([ saveDir,  'USA_validationPoints'],'-png','-r250')