Gnuplot says file is unreadable - file-io

I have a file called "data_prova.dat" in my folder, as you can see:
gnuplot> !ls
data_prova.dat
But when I ask gnuplot to plot it, it says:
warning: Skipping unreadable file "./data_prova.dat"
No data in plot
which is just false, because:
wc -c data_prova.dat
2640413132 data_prova.dat
Can this be because the file is too large?

I changed my file name and it's now working.

Related

gdal_translate NetCDF to GeoTiff file conversion not working

I am new to geospatial analytics and using NetCDF and GeoTIFF files. I am trying to convert the NetCDF file into GeoTIFF file. I came across this reference: netcdf-to-geotiff-file-conversion. I have successfully installed and can run gdal_translate in my MacOS terminal. However, I get this message I am trying to understand what this means and what I am missing? This appears to be warning, however it didn't generate any output.
My code executed:
gdal_translate some_nc_file_name.nc output.tif
Error/Message:
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Input file contains subdatasets. Please, select one of them for reading.
Here is my data output I previewed in Python:
You appear to have multiple variables in the file, so need to select one. Example (following https://nsidc.org/support/how/how-convert-golive-netcdf-variables-geotiff).
gdal_translate NETCDF:"Input_FileName.nc":variable_name Output_FileName.tif
Based on the warning message, the netCDF file lacks certain important attributes, so some issues may exist with the coordinates etc. in the tif.

How to zcat a zip file saved from pandas.to_csv

I've been using pandas.to_csv on a mac to save csv.zip files. When I try to zless or zcat them on my mac, I see gibberish. I can read_csv them just fine. locale gives me
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
If that helps. Does anyone know what I need to do to be able to open them from the command line?
Seems you have to unzip the file. You can use unzip -c to print to stdout and pipe to something else. You'll some meta data at the beginning you can trim with tail.

GIMP Script.Fu script to batch convert JPEG to PNG

Can someone give me the script I would need to run to batch convert many *.jpeg files to *.png in Script.Fu in GIMP?
Currently I am spending way too much time manually exporting every image and it's a waste of time.
I can't install anything right now so can't use alternative applications.
Alright, after a lot of trials and errors I finally figured out how to convert one file format to another using only GIMP.
This is the Script-Fu script for conversion to PNG:
(
let* ((filename "{{filename}}")
(output "{{output}}")
(image (car (gimp-file-load 1 filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(file-png-save-defaults 1 image drawable output output)
)
Where {{filename}} is input file that needs to be converted (a jpeg file, for example), {{output}} is the output file that you need (it can be simply the same file name but with PNG extension)
How to run it: it can probably be improved
gimp -i -n -f -d --batch "{{one-line script-fu}}"
More about command line options you can find in GIMP online documentation.
The place that needs to be changed is {{one-line script-fu}} and it has to be... one-line! You can probably do all of this in one file using cmd (in case if you use Windows), but for me it was easier to use Python, so here's the script for it:
import subprocess, os
def convert_to_png(file_dds):
#Loads the command to run gimp cli (second code block)
#Note: remove "{{one-line script-fu}}" and leave one space after the --batch
with open("gimp-convert.bat", "r") as f:
main_script = f.read()
#Prepares the Script-Fu script to be run, replacing necessary file names and makes it one-line (the firs code block)
with open("gimp-convert-png.fu", "r") as f:
script = f.read().replace("\n", " ").replace("{{filename}}", file_dds) \
.replace("{{output}}", file_dds[:-3]+"PNG").replace("\\", "\\\\").replace("\"", "\\\"")
subprocess.run(main_script + " \"" + script + "\" --batch \"(gimp-quit 1)\"",
cwd = os.getcwd(),
shell = True)
And you should get your file converted to PNG!
I needed this for my texture upscale project, all of the code below you can find here.
Tested with GIMP 2.10
The real solution is to use ImageMagicks convert, as simple as magick convert some.jpeg some.png. There must be a "portable" version somewhere that you can use off a USB key.
Otherwise with Gimp, a much less manual way that doesn't need for a new script, since it uses an existing script:
get/install ofn-export-layers
File>Open the first JPEG
File>Open as layers more Jpegs. You can select several/all jpegs in one call (actual number limited by available RAM mostly). Once this is done you have many Jpegs stacked in the same image
File>Export all layers, making sure the name pattern you use ends in .png (the doc that comes with the script explains how that works).

Batch file to convert all pdf to text (with xpdf)

I would like to run a batch conversion in a folder with full of pdf files. I have using xPDF and this is the command prompt for a single file:
c:\Test\pdftotext -layout firstpdftoconvert.pdf firstpdfconverted.txt
Could somebody help please to do it in one go (convert all the pdf files only) using a batch file? Thanks in advance!
Combining your question with this answer iterating over files of a directory:
for /r %i in (*.pdf) do "c:\Test\pdftotext" -layout "%i"
This will work on all pdf files in the current directory.
Be sure to double the % signs if you run this from a batch file.

Error in Converting PDF to PostScript with GhostScript, Access is denied Unable to open command line file _.at

I installed ghostscript and updated the appropriate path variables ... however, I'm getting an error when I try to execute this command:
C:\PROGRA~1\gs\gs8.64\lib>pdf2ps mydocument.pdf mydocument.ps
Access is denied.
Unable to open command line file _.at
Is this the right command? Did I miss some configuration or path setting? Otherwise, is there a sane method of doing this conversion?
Access is denied suggest something to do with access to paths etc. I'd suggest rechecking the folder permission (although I'm sure you've done that). Also, you might want to try running the gswin32c.exe instead of the pdf2ps to see if you still get the error, you might get something a little more specific.
gswin32c.exe ^
-dNOPAUSE ^
-dBATCH ^
-sDEVICE=pswrite ^
-sOutputFile=mydocument.ps ^
mydocument.pdf
Using pdf2ps runs a batch file, really named pdf2ps.bat or pdf2ps.cmd. You can easily look up and understand its "source code". If you do, you'll see it tries to write some of its commandline options into a temporary file named _.at, in order to overcome the 128 character limit for DOS/cmd commandline length that exist on some Win/DOS platforms.
Since you are invoking pdf2ps from the %programs% directory where Ghostscript is installed, you don't seem to be using an account that is permitted to write stuff in there. :-)
With Ghostscript version gs9.10 the method pswrite didn't worked for me instead I tried using ps2write instead, and it worked for me, so the command worked for me is as below:
gswin32c.exe ^
-dNOPAUSE ^
-dBATCH ^
-sDEVICE=ps2write ^
-sOutputFile=mydocument.ps ^
mydocument.pdf
and if this thing doesn't even works, then one can do this :
try getting help by typing gswin32c.exe -h and then it will list all the available devices as shown below:
Default output device: display
Available devices:
bbox bit bitcmyk bitrgb bj10e bj200 bjc600 bjc800 bmp16 bmp16m bmp256
bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cdeskjet cdj550 cdjcolor cdjmono
cp50 declj250 deskjet devicen display djet500 djet500c eps9high eps9mid
epson epsonc epswrite ibmpro ijs inkcov jetp3852 jpeg jpegcmyk jpeggray
laserjet lbp8 lj250 ljet2p ljet3 ljet3d ljet4 ljet4d ljetplus m8510
mswindll mswinpr2 necp6 nullpage pamcmyk32 pamcmyk4 pbm pbmraw pcx16
pcx24b pcx256 pcxcmyk pcxgray pcxmono pdfwrite pgm pgmraw pgnm pgnmraw pj
pjxl pjxl300 pkmraw plan planc plang plank planm plib plibc plibg plibk
plibm png16 png16m png256 pngalpha pnggray pngmono pngmonod pnm pnmcmyk
pnmraw ppm ppmraw **ps2write** psdcmyk psdrgb pxlcolor pxlmono r4081 spotcmyk
st800 stcolor svg t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc
tiff32nc tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray
tifflzw tiffpack tiffscaled tiffscaled24 tiffscaled32 tiffscaled4
tiffscaled8 tiffsep tiffsep1 txtwrite uniprint xpswrite
Search path:
C:\Program Files (x86)\gs\gs9.10\bin ;
C:\Program Files (x86)\gs\gs9.10\lib ;
C:\Program Files (x86)\gs\gs9.10\fonts ; %rom%Resource/Init/ ;
%rom%lib/ ; c:/gs/gs9.10/Resource/Init ; c:/gs/gs9.10/lib ;
c:/gs/gs9.10/Resource/Font ; c:/gs/fonts
Initialization files are compiled into the executable.
As one can see only for the convenience only I have placed star(*) around the ps2write
use gimp open PDF file.
file -> export -> postscript.
If you want to use the gs executable you have to change the permissions.In the command prompt go to the location where gs executable is located and then use chmod 755 gs.
What you are doing is you are not writing command line at right place first you have to find out the instillation exe of ghostscript which is by default located at
c:\Program Files(x86)\gs\gs9.20(your ghostscript
version)\bin\gswin32c.exe
there are two exe
1- gswin32.exe
2- gswin32c.exe
you have to use the second one because it execuit commmands at cmd not in gs cmd
ok now what you have to do is write command like
...bin\gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=mydocument.ps mydocument.pdf
note please check the file path correctly and one more thing
file path like
"D:\htmltopdf\document.ps"
should be write as
"D:/htmltopdf/document.ps"
yes exactly replace backward slash with foreword slash only in file path
and the command line is case sensitive also so be carefull with cases