"End Of File" Error While Converting ASCII to GRD - unix

I am trying to run a FORTRAN program (with gfortran) where I convert an ASCII file to a GRD file. I'm expecting the program to read a text file and then output a grd file.
After running the program, I am getting the following error message:
Fortran runtime error: End of file
Below are the files that I am working with:
Terminal Commands:
gfortran ascii2grd.f90
./a.out
FORTRAN Program:
!PROGRAM TO CONVERT ASCII TO GRD
program ascii2grd
parameter(nx=25,ny=23,np=1)
real u(nx,ny,np),temp1(nx,ny)
open(2,file='/home/weather/test.grd',
form='unformatted',access='direct',recl=nx*ny*4)
open(1,file='/home/weather/out.dat')
do k=1,np
read(1,*)((u(j,i,k),j=1,nx),i=1,ny)
10 continue
enddo
rec=1
do kk=1,np
write(2,rec=irec)((u(j,i,kk),j=1,nx),i=1,ny)
write(*,*)'Processing...'
irec=irec+1
enddo
write(*,*)'Done!'
stop
end
Sample from out.dat
999.000000
11.1000004
999.000000
999.000000
16.7000008
999.000000
14.6000004
999.000000
999.000000
999.000000

Related

R optparse error with command line arguments

For some reason, the optparse usage in this script breaks:
test.R:
#!/usr/bin/env Rscript
library("optparse")
option_list <- list(
make_option(c("-n", "--name"), type="character", default=FALSE,
dest="report_name", help="A different name to use for the file"),
make_option(c("-h", "--height"), type="numeric", default=12,
dest = "plot_height", help="Height for plot [default %default]",
metavar="plot_height"),
make_option(c("-w", "--width"), type="numeric", default=10,
dest = "plot_width", help="Width for plot [default %default]",
metavar="plot_width")
)
opt <- parse_args(OptionParser(option_list=option_list), positional_arguments = TRUE)
print(opt)
report_name <- opt$options$report_name
plot_height <- opt$options$plot_height
plot_width <- opt$options$plot_width
input_dir <- opt$args[1] # input directory
I get this error:
$ ./test.R --name "report1" --height 42 --width 12 foo
Error in getopt(spec = spec, opt = args) :
redundant short names for flags (column 2).
Calls: parse_args -> getopt
Execution halted
However, if I remove the "-h" from this line:
make_option(c("--height"), type="numeric", default=12,
dest = "plot_height", help="Height for plot [default %default]"
It seems to work fine;
$ ./test.R --name "report1" --height 42 --width 12 foo
$options
$options$report_name
[1] "report1"
$options$plot_height
[1] 42
$options$plot_width
[1] 12
$options$help
[1] FALSE
$args
[1] "foo"
Any ideas what might be going on here?
I am using R 3.3.0 and optparse_1.3.2 (getopt_1.20.0)
The -h flag is reserved by optparse (which is described as a feature of optparse which is not in getopt, from the getopt.R source file on Github):
Some features implemented in optparse package unavailable in getopt:
2. Automatic generation of an help option and printing of help text when encounters an "-h"
Therefore, when the user specifies -h, the sanity check for uniqueness of flags fails. The issue tracker does not seem to have any mention of the need to create a better error message for this case, however.
Finally, note that optparse seems to be invoking getopt, as they have the same author.

yosys fails at ABC pass (on counter.v demo)

I hope someone can help me with this...
This is my first encounter with yosys. For the start, I'm trying to run the very same demo as Clifford explained in his presentation. I downloaded the demo at the following location: https://github.com/cliffordwolf/yosys/tree/master/manual/PRESENTATION_Intro
yosys run beaks at the ABC pass with following message:
12. Executing ABC pass (technology mapping using ABC).
12.1. Extracting gate netlist of module `\counter' to `<abc-temp-dir>/input.blif'..
Extracted 6 gates and 12 wires to a netlist network with 4 inputs and 2 outputs.
12.1.1. Executing ABC.
Running ABC command: <yosys-exe-dir>/yosys-abc -s -f <abc-temp-dir>/abc.script 2>&1
ABC: ABC command line: "source <abc-temp-dir>/abc.script".
ABC:
ABC: + read_blif <abc-temp-dir>/input.blif
ABC: + read_lib -w /home/boris/Documents/Self Learning/yosys_synthesys/mycells.lib
ABC: usage: read_lib [-SG float] [-M num] [-dnvwh] <file>
ABC: reads Liberty library from file
ABC: -S float : the slew parameter used to generate the library [default = 0.00]
ABC: -G float : the gain parameter used to generate the library [default = 0.00]
ABC: -M num : skip gate classes whose size is less than this [default = 0]
ABC: -d : toggle dumping the parsed library into file "*_temp.lib" [default = no]
ABC: -n : toggle replacing gate/pin names by short strings [default = no]
ABC: -v : toggle writing verbose information [default = yes]
ABC: -v : toggle writing information about skipped gates [default = yes]
ABC: -h : prints the command summary
ABC: <file> : the name of a file to read
ABC: ** cmd error: aborting 'source <abc-temp-dir>/abc.script'
ERROR: Can't open ABC output file `/tmp/yosys-abc-KDGya6/output.blif'.
[boris#E7440 yosys_synthesys]$
I have had a look at the file location mentioned in the error statement above, there is no output.blif in there:
[boris#E7440 yosys_synthesys]$ ll /tmp/yosys-abc-KDGya6/
total 12K
-rw-rw-r--. 1 boris boris 542 Jul 5 11:21 abc.script
-rw-rw-r--. 1 boris boris 526 Jul 5 11:21 input.blif
-rw-rw-r--. 1 boris boris 852 Jul 5 11:21 stdcells.genlib
[boris#E7440 yosys_synthesys]$
Buy the way, here is some system/tools info that might be relevant for debugging:
Linux E7440.DELL 4.4.13-200.fc22.x86_64 #1 SMP Wed Jun 8 15:59:40 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Yosys 0.6+141 (git sha1 080f95f, gcc 5.3.1 -fPIC -Os)
UC Berkeley, ABC 1.01 (compiled Mar 8 2015 01:00:49)
The issue has been resolved...
Solution =
Changed rundir from:
/home/boris/Documents/Self Learning/yosys_synthesys/mycells.lib
to:
/home/boris/Documents/SelfLearning/yosys_synthesys/mycells.lib
Lesson learned =
ABC tool does not accept space characters in the path/file name.

Save GIF with Animation package {R}

I would like to save a set of maps as gif with the animation package. I produce these maps for different years through a function I created. The function works.
However, I don't manage to save the output as a gif. This is what I coded:
i<- 1
saveGIF(
for(i in 1955:1957)
multiplePlots(i),
interval = .65,
movie.name = "test.gif",
img.name="test",
convert = "convert"
)
The error is the following (copy-pasted from the console, I hope it helps):
Executing:
""C:\Program Files\ImageMagick-6.9.3-Q16\convert.exe" -loop 0 -delay 65 test1.png test2.png test3.png "test.gif""
convert.exe: unable to load module `C:\Program Files\ImageMagick-6.9.3-Q16\modules\coders\IM_MOD_RL_PNG_.dll': Le module spécifié est introuvable.
# error/module.c/OpenModule/1300.
convert.exe: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/501.
convert.exe: unable to load module `C:\Program Files\ImageMagick-6.9.3-Q16\modules\coders\IM_MOD_RL_PNG_.dll': Le module spécifié est introuvable.
# error/module.c/OpenModule/1300.
convert.exe: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/501.
convert.exe: unable to load module `C:\Program Files\ImageMagick-6.9.3-Q16\modules\coders\IM_MOD_RL_PNG_.dll': Le module spécifié est introuvable.
# error/module.c/OpenModule/1300.
convert.exe: no decode delegate for this image format `PNG' # error/constitute.c/ReadImage/501.
convert.exe: no images defined `test.gif' # error/convert.c/ConvertImageCommand/3252.
an error occurred in the conversion... see Notes in ?im.convert
[1] FALSE
Warning messages:
1: running command 'C:\Windows\system32\cmd.exe /c ""C:\Program Files\ImageMagick-6.9.3-Q16\convert.exe" -loop 0 -delay 65 test1.png test2.png test3.png "test.gif""' had status 1
2: In cmd.fun(convert) :
'""C:\Program Files\ImageMagick-6.9.3-Q16\convert.exe" -loop 0 -delay 65 test1.png test2.png test3.png "test.gif""' execution failed with error code 1
3: running command '""C:\Program Files\ImageMagick-6.9.3-Q16\convert.exe" -loop 0 -delay 65 test1.png test2.png test3.png "test.gif""' had status 127
4: In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="test.gif": Le fichier spécifié est introuvable
In case you are wondering, I have ImageMagick installed.
Many thanks.

Caused a HMError when running HTKDemo

I just installed HTS-2.2 and HTK-3.4.1 in my 64bit Ubuntu with gcc 3.4 compiler. After that, typing HInit and HCopy etc. seemed work. So I wondered how the HTKDemo works.
When I run the demo, HTK caused a problem:
HMM Def Error: <Mean> symbol expected in GetMean at line 6/col 11/char 120 in proto/L
ERROR [+7050] HMError:
HMM Def Error: GetMean Failed at line 6/col 12/char 121 in proto/L
ERROR [+7050] HMError:
HMM Def Error: Regression Class Number expected at line 7/col 0/char 122 in proto/L
ERROR [+7050] HMError:
HMM Def Error: GetMixtures failed at line 7/col 1/char 123 in proto/L
ERROR [+7050] HMError:
HMM Def Error: Get Stream Information failed at line 7/col 2/char 124 in proto/L
ERROR [+7050] HMError:
HMM Def Error: GetStream failed at line 7/col 3/char 125 in proto/L
ERROR [+7050] HMError:
HMM Def Error: GetStateInfo failed at line 7/col 4/char 126 in proto/L
ERROR [+7050] HMError:
ERROR [+7032] LoadHMMSet: GetHMMDef failed
ERROR [+2128] Initialise: LoadHMMSet failed
FATAL ERROR - Terminating program HInit
Source Directory Empty hmms/hmm.0
The same to the proto S, V, N, C.
I really want to know the reason and how to fix it? Thx!
I got the same +7050 error, in my case was a mispelled hmm definition file, probably you have the same problem since the error reported: " symbol expected".
Just check your definition file had the right format as follows:
~h (phoneme name)
<BEGINHMM>
<NUMSTATES> (NStates)
<STATE> 2 (number starting from 2, ending NStates-1 )
<MEAN> 13 (or any number defined)
-4.717658e+000 ...
<VARIANCE> 13 (the same as mean possibly)
4.735534e+001 ...
<STATE> 3 ....
...
<GCONST> 1.269744e+002
<TRANSP> 3 (again not important)
0.0 1.0 0.0
0.0 0.9 0.1
0.0 0.0 0.0
<ENDHMM>
~h (next phoneme )
...

Is there an 11 digits limit for time series numbers in x12 for R?

I am trying to use the x12 function in the x12 package for R.
My problem is, when using time series object (tso) with monthly data and each observation is a large number (11 or more digits), the function is making a spec file which x12a.exe (binaries) can not read.
x12 binaries does not allow the spec file to be wider then 132 column.
In my example, the spec file have 144 columns, which I believe give me this error message in R:"ERROR: Input record longer than limit : 133".
When I am using smaller numbers (fewer columns) in the spec file, there are no problem so far. When creating the spec file on my own, when using x12-arima for windows, I have never seen the problem before, because I always use the "free" format (one observation per line) for the series in x12-arima.
My question is: How do I make the format for the time series object = "free", or some how just one observation per line, in the "Rout.spc" file, while using x12 function in the x12 package for R?
I am using R version 2.15.2 and R-studio version 0.97.318
Attached is my example code in R-studio, output in R-console, and the spec file
"Rstudio"
library(x12)
alt <- read.csv2("alt.csv",header=T)
tal <- ts(data=alt,start=c(1995,4),freq=12)
x12path <- shortPathName("C:\\Dokumenter\\X_12_Arima_Program\\x12a\\x12a.exe")
x12tal <- x12(tso=tal,automdl=T,x12path=x12path,period=12,trendma=23)
"Console"
C:\Dokumenter\Eksperimentering\x12>md gra
C:\Dokumenter\Eksperimentering\x12>C:\DOKUME~1\X_12_A~2\x12a\x12a.exe Rout -g gra
X-12-ARIMA Seasonal Adjustment Program
Version Number 0.3 Build 192
Execution began Mar 12, 2013 23.46.25
Reading input spec file from Rout.spc
Storing any program output into Rout.out
Storing any program error messages into Rout.err
ERROR: Input record longer than limit : 133
Line 6: start=1995.4
^
ERROR: Expected an real number not "111"
Program error(s) halt execution for Rout.spc
Check error file Rout.err
Error messages generated from processing the X-12-ARIMA spec file
Rout.spc:
Error in readx12Out(file, freq_series = frequency(tso), start_series = start(tso), :
Error! No proper run of x12! Check your parameter settings.
"The spec file: Rout.spc"
series{
title="R Output for X12a"
decimals=2
start=1995.4
period=12
data=(
14056669449 12785389868 12772341230 12342935128 12081332395 12110109950 12367542268 12911930417 12836340370 12214486074 12057940408 11555540809
10002847699 9199284760 8704422249 8492914782 8507816348 8470254675 8665139772 8653204621 9177471163 9676069791 9483990311 9825510541
7613345714 7168896536 7527318694 7721174940 7584049271 7586159794 7411383039 7565724342 7555103032 7148551906 7792379395 7493885451
6636374143 6390731897 6160711917 6003196233 5955867663 5868369296 5858314348 6098506333 6297774946 6074680955 6132163345 5875098456
5198306672 4891946405 4875765641 4834436461 4835096514 4804664875 4684550404 4733459404 5056773308 4912329843 5080643820 4568733581
4286693348 3898776528 3872776341 3842469172 3756957390 3782676505 3924066331 3810475969 3943259720 3665136687 3962811976 3449264257
3120637669 2813261665 2692920289 2652153941 2557247524 2658115616 2777287302 2688976703 2712004412 2596430893 2520548046 2455531008
2429263753 2187017586 2181610529 2139024441 2008850781 2049874584 2110715482 2218937956 2565352715 2635375627 2598584163 2435211675
2433625715 2350144562 2298764466 2242464445 2288528533 2532374821 2696862060 2877128057 3086285374 3309497319 3684989376 3709283880
3483967873 3294407926 3465439983 3546006197 3526166213 3625899404 3774201496 3941610691 4325836434 4466576126 4115121591 4036118609
3824882119 3552896925 3649624960 3570454122 3622089655 3662984491 3601306018 3604389348 3620162022 3401732239 3158217491 2896252892
2800864675 2630474256 2668229303 2631120097 2343131082 2163910930 2108285015 2067601541 2099699134 1803097392 1742652674 1626660618
1560369744 1448264771 1419659828 1547101381 1310783818 1358686467 1300281852 1315247637 1380387680 1286158497 1329769957 1272124521
1185603967 1125238745 1217223861 1265616553 1222054134 1279497332 1499392605 1810208712 2314301847 2908395453 3388479445 3441615991
3432688695 3691000321 3891303059 4111250935 4258776704 4586315450 5050122946 5156728599 5550332779 5769588984 5943764465 6032516246
5765718572 5521116586 5498458566 5374456514 5130561755 5219814632 5542173962 6883624616 7744043244 7913799960 7416210299 7127265644
6790509897 6562709494 6390985216 6126897801 5855125688 6259675447 6439114484 6634617502 6771498442 6674343925 6295709586 5890916431
5545655270 5315444742 5205711894 5115065476 4648229650 4724377012 4816989052 5049928441 5041395923
)
}
transform{
function=auto
}
automdl {
maxorder=(3,2)
maxdiff=(1,1)
balanced=yes
savelog=(adf amd b5m mu)
}
forecast {
}
x11{
sigmalim=(1.5,2.5)
trendma=23
excludefcst=yes
final=(user)
appendfcst=yes
savelog=all
}

Resources