Wildcard in GDAL command - wildcard

I have an archive of images and in each image folder there are 13 bands data. Now i have generated a list of all that images and want to make RGB for each of them in GDAL by using for loop. following is my command.
for /F "delims=" %a in (G:\list.txt) do(gdal_merge.py -separate -o
G:%~paRGB.jp2 G:%pa_B04 G:%pa_B03 G:%pa*_B02)
But asterisk(*) character is not working here and returns error? What I am doing wrong? I am using GDAL 1.10 version.

Related

makefile into debian package, copy files and directories recursively

I realized that with debian/rules
override_dh_auto_install:
dh_auto_install -- prefix=/usr
it's impossible to get a file copied into the directory structure of the debian package with the cp command, but with install yes. So I understood, or interpreted that only the install command is interpreted by the dpkg-buildpackage -us -uc -ui -i command to copy temporarilly the files into the .deb file before installing them during any dpkg -i process.
The problem is that when I want to copy many files and an entire directory structure, I'm unable to do it as mentionned in various places on the web with tricks like find command for ex.
So the problems I have now is how from a Makefile do I specify that I want that to be converted into real world of debian package??!!!
cp -r some/src/dir/from/current_dir /to/opt/myCompany/for/example/bin
ln -s /to/opt/myCompany/for/example/bin/ /usr/local/bin
Both are misinterpreted by the dpkg-buildpackage

How to create MacOS/Linux link for reading data file?

I have a huge raw data file which I do not intend to change or copy. And I have two projects in RStudio and both need to be able to access it.
I originally created the alias (in MacOS) in the following way
right click the file ~/A/data.csv in finder, and click "make alias". Then copy the alias to ~/B/ and rename it ~/B/data.csv
I also tried the following command later
ln -s ~/A/data.csv ~/B
For project A, I put the actual data file in A/data/data.csv.
For project B, I created an alias under B/data/.
But when I try fread('B/data/data.csv'), it complains:
sh: ./data/data.csv: Too many levels of symbolic links
Error in fread("./data/data.csv") :
File is empty: /var/folders/4h/2jg64xk52mv3fyq4sb7s371w0000gn/T//Rtmp7cWNN3/filebf3013ad9194
I think I can use a hard link to solve this issue, but just want to see if I can use alias to make it work.
=====
I don't think it matters, but for completeness, see the following for my OS and R version:
platform x86_64-apple-darwin10.8.0
arch x86_64
os darwin10.8.0
system x86_64, darwin10.8.0
status
major 3
minor 1.0
year 2014
month 04
day 10
svn rev 65387
language R
version.string R version 3.1.0 (2014-04-10)
nickname Spring Dance
I'm not entirely sure why using aliases in this specific case:
note that for small files (e.g. < 1 MB), the alias can have a way bigger memory footprint. For example, for a simple text file containing "test" (echo "test" > test.txt) the alias will be 274k times bigger:
test.txt: 5 bytes
test.txt alias: 1372636 bytes
since RStudio is good at using absolute paths, why not directly link to ~/A/data.csv directly rather than linking to it's alias?
Two alternative solutions (not directly answering question) could be to (1) copy the file or (2) create a kind of symbolic link.
Copying the file
#!/bin/bash
mkdir ~/B/data/
cp ~/A/data.csv ~/B/data/
Or in R, using system (on Mac):
system("mkdir ~/B/data/")
system("cp ~/A/data.csv ~/B/data/")
Creating a symbolic link
This can be done by simply saving the path of the file ~/A/data.csv in ~/B/data/.
In shell:
#!/bin/bash
mkdir ~/B/data/
echo "~/A/data.csv" > ~/B/data/data.csv
(this part can be also done in R using system() as above)
And then, in R:
## Reading path in B/data/
PATH <- scan(file = "~/B/data/data.csv", what = character())
## Opening the file (~/A/data/data.csv)
my_csv <- read.csv(PATH)

Reference manuals in R

Every package on CRAN seems to provide a reference manual but in contrast to vignettes they do not seem to get downloaded or built when installing packages. Can this be done so that I can access them from the command line in R or can I only access them on CRAN?
From a given package's sources, you can build this via R CMD Rd2pdf:
edd#max:~$ R CMD Rd2pdf --help
Usage: R CMD Rd2pdf [options] files
Generate PDF output from the Rd sources specified by files, by
either giving the paths to the files, or the path to a directory with
the sources of a package, or an installed package.
Unless specified via option '--output', the basename of the output file
equals the basename of argument 'files' if this specifies a package
or a single file, and 'Rd2' otherwise.
The Rd sources are assumed to be ASCII unless they contain \encoding
declarations (which take priority) or --encoding is supplied or if using
package sources, if the package DESCRIPTION file has an Encoding field.
The output encoding defaults to the package encoding then to 'UTF-8'.
Files are listed in the order given: for a package they are in alphabetic
order of the \name sections.
Options:
-h, --help print short help message and exit
-v, --version print version info and exit
--batch no interaction
--no-clean do not remove created temporary files
--no-preview do not preview generated PDF file
--encoding=enc use 'enc' as the default input encoding
--outputEncoding=outenc
use 'outenc' as the default output encoding
--os=NAME use OS subdir 'NAME' (unix or windows)
--OS=NAME the same as '--os'
-o, --output=FILE write output to FILE
--force overwrite output file if it exists
--title=NAME use NAME as the title of the document
--no-index do not index output
--no-description do not typeset the description of a package
--internals typeset 'internal' documentation (usually skipped)
--build_dir=DIR use DIR as the working directory
The output papersize is set by the environment variable R_PAPERSIZE.
The PDF previewer is set by the environment variable R_PDFVIEWER.
Report bugs at bugs.r-project.org .
edd#max:~$

Convert grib to netcdf file

Is there a way to convert a grib file into a NetCDF format on Windows?
I use a software named tkdegrib but it catches one argument by one argument whereas I want all my grib's arguments in the same file.
Unfortunately, I can't use Linux.
I would use Unidata's NetCDF-Java library.
It reads GRIB and GRIB2 files (as well as many others), and can write NetCDF files. And since it's Java, you don't have to build anything, and it works on all platforms. There is a ToolsUI application that you can use if you want a GUI, but more likely you want to do it from the command line using something like this:
java -Xmx512m -classpath netcdfAll-4.3.jar ucar.nc2.dataset.NetcdfDataset -in infile.grib2 -out outfile.nc
Good luck!
1. Climate data operators
If you have Windows 10 installed, it is now very easy to simply install ubuntu directly under windows as a subsystem (no wineserver or cygwin required), and then you can install CDO very easily with
sudo apt install cdo
once done you can do:
cdo -f nc copy file.grb file.nc
2. ECCODES
ECMWF has developed a new package called eccodes which includes command line operators for this kind of task. This is the preferred method if you have grib data with more than one time axis such as S2S output, where you have the time of the forecast start and the forecast step and possibly even the hindcast start date. In those cases CDO fails.
You can install it under windows using this guide:
https://confluence.ecmwf.int/pages/viewpage.action?pageId=70949236
Or easily on the linux subsystem with sudo apt-get (on MAC OSX you can install with: brew install eccodes).
Then from the subsystem command line you can simply type:
grib_to_netcdf -o out.nc in.grb
There is GDAL utility gdalwarp, which can convert grib dataset into netCDF dataset.
The command for conversion is
gdalwarp -overwrite -to SRC_METHOD=NO_GEOTRANSFORM -t_srs EPSG:4326 input.grb -of netCDF output.nc
For more options of this utility can be searched on this link.

shp to topojson conversion : no output

Topojson's doc states:
You can specify ESRI shapefiles as input:
topojson -o output.json input.shp
My .shp file is valid, npm and topojson are installed, and I'am in the input file's directory (cd). This topojson command simply doesn't work on my side, no output, nor feedback produced.
How do you convert shp into topojson on your side ?
which topojson gives /usr/local/bin/topojson
which ogr2ogr gives /usr/bin/ogr2ogr
On ubuntu 13.04, but I think my issue is not related to ubuntu.
Nodesjs was corrupted, I had to remove, clean up, then reinstall nodejs & topojson. See this overflow

Resources