I cannot get the Parse Path tool to pass each file name to the next tool. In the example shown, the Raster to Ascii tool will take the first entry in the 'filename' variable list as part of the output name. But when it runs the next iteration, the Raster to Ascii tool uses some generic file naming convention. 'filename' is set as a precondition for the R2A tool.  Example: raster1.tif raster2.tif Run the Model in Batch mode, using tifs as parameters. 1st output = raster1_asc.txt 2nd output = RastTo_rast.txt &lt;--- this is wrong.    Summary: Raster to Ascii tool sucessfully uses the filename variable as inline variable as part of the output file name. However, the the Raster to Ascii tool uses a generic naming convention for the following files (running Model as Batch).  Does anyone have an insight as to why this is happening?
72364
Am I correct that if my model has a model-only tool (Calculate Value), and then I run the model as a batched process, it will not run the Calculate Value expression?   I wrote a model to upload, define, project (and clip) XY data from excel files. I had thought to use iterate tables, but it wasn't working. (I assume due to having to choose which worksheet within xlxs). So I thought to do a batch, but this seems to leave that annoying $ that arc appends to table names (and is an invalid character in most tools...)  My guess is that the Calculate value that removes my $ is not being run in the batch. Ideas? Confirmations?
47331
I am running a model which I created with ModelBuilder at 10.3. The model is supposed to make a selection by attribute on a feature layer, and use that layer to clip a raster. The model is working fine when I run it, however if I try to use it in batch mode it gives unexpected results: I have many files with the same extent and content as the first line of the loop (of the batch).  The parameters of my models are:   the input feature layer against which a selection is specified the input raster (.BIL)to be clipped with the selected feature the SQL expression for the selection (of the type "FIELD" = 'value') the output folder and filename (with .BIL extension)   Basically, in the batch window the feature and raster parameters are fixed, I am only changing the SQL expression to point a different 'value', so that the output raster is clipped on different areas each time, and the filename name of the output.  Below is my model:
77484
I'm writing a generic script which involves writing shapefiles to a directory which are then merged together. After writing the files out to the Output folder, I'm trying to get the saga:mergeshapeslayers algorithm to merge all the files in the Output folder. I have used the Model Builder and although it is helpful to an extent, I find that it is used for specific purposes whereas I am attempting to make a script for generic purposes.   Code:  ##Test=name ##Select_folder=folder ##Result=output vector  import os import glob  path_1 = Select_folder path = path_1 os.chdir(path)  def function():      output = glob.glob(path_1 + './*.shp')     x = 0      while output[x]:         for fname in glob.glob("*.shp"):             outputs_1 = processing.runandload("qgis:fieldcalculator", output[x], 'Number', 1, 10, 0, True, 1 , "C:\Users\Me\Desktop\Output\\"  + fname)             multiple_0 = glob.glob("*.shp")             x = x + 1          if x + 1 &gt; len(output):             processing.runalg("saga:mergeshapeslayers", output[0], ";".join(multiple_0) , Result)             break         else:             continue  if path_1:     function() else:    pass
104899
I have a file that contains filenames with absolute path.  In the middle of that path, is a variable directory, whenever I hard code the variable part, it works fine, but when I replace it with the variable name, the sed part doesn't work.  The sed part is to delete the pattern or for this matter, the path.   file=`echo $one_file | sed 's:/dir1/dir2/$VAR/last_dir/::'`
55298
Lets say that I have a directory with the following files (among others):  touch doc-mike.txt doc-jane.txt doc-susan.txt   I can do something in a script with those files using a construct like:  for fname in doc-*.txt; do     echo input: ${fname} done   But if I want to get the substring of the filename that matches the wildcard I have to jump through some ugly hoops:  for fname in doc-*.txt; do     wildcard=${fname#doc-}     wildcard=${wildcard%.txt}      echo input: ${fname} output: output-${wildcard}.results done   That works:  input: doc-jane.txt output: output-jane.results input: doc-mike.txt output: output-mike.results input: doc-susan.txt output: output-susan.results   but I feel like there has to be a better/easier way to get the substring that matches the "*" glob wildcard
123475
If I have a number of directories, named, for example 10001 through 10025 is there any reason to use ls 1*/foo vs. ls 100??/foo?  I have a lot more than 25 of them, so I mostly curious if there's any differences in speed.  I know the difference in use between the two, that the asterisk will match longer file names, like 10001.backup. But let's say I don't have any files that don't follow my conventions. Is there any behind-the-scenes differences?
43966
When I cut one raster with clip raster by mask layer I get the expected result.  But when applying batch processing with the same vector file, and the same rasters, the rasters aren't clipped and the values are changed to 0 and NaN?  The rasters are landsat 5 images, and the vector has the same datum.  Edit: I've figured out this is the gdal command used when processing individually:  gdalwarp -ot Float32 -q -of GTiff -cutline "some_shape.shp" -co COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=6 -wo OPTIMIZE_SIZE=TRUE "original_raster.tif" "clipped_raster.tif"  And this one is used in batch processing:  gdalwarp -ot Byte -q -of GTiff -cutline "some_shape.shp" -co COMPRESS=NONE -wo OPTIMIZE_SIZE=TRUE "original_raster.TIF" "clipped_raster.tif"  Why the differences?
79894
Can you explain what this command does:  files=(this_is_filename) for filename in ${files[@]}; do    ls -t1 ../htory/$filename* |     head -1 |     xargs -I fname cp -p fname ../htory2/somefile.CSV done   Especially this part of this command  xargs -I fname cp -p fname ../htory2/somefile.CSV
48423
I want to create multiple files at a time using names from a file list.txt, how can I do it?  Sample list.txt:  EOG090W002U EOG090W00C1 EOG090W00DC EOG090W00DE EOG090W00E5 EOG090W00HR EOG090W00MH EOG090W00MS EOG090W00PB EOG090W00U4 EOG090W00UK EOG090W00WM EOG090W00WR   Suppose I have this list.txt containing some id-numbers. Now I want to make separate files using these ids as the name (e.g. EOG090W002U_M0.ctl, EOG090W00C1_M0.ctl, EOG090W00DC_M0.ctl). Also, the contents of the files need to be change accordingly. For example the content of EOG090W002U_M0.ctl, EOG090W00C1_M0.ctl file will be   seqfile = EOG090W002U_p.phy treefile = Constant.txt outfile = EOG090W002U_M0_mlc   or  seqfile = EOG090W00C1_p.phy treefile = Constant.txt outfile = EOG090W00C1_M0_mlc   where *.phy and Constant.txt will be provided in the same folder.
85216
What's the best practice for naming LaTeX files?  I know R, Matlab, and Java all differ in their use of ., _, -, camel case, capitalization, etc. What do people generally use for naming LaTeX files? Is this easily portable across systems?  I remember having a HUGE problem interpreting a Matlab program of mine. Turned out that I had named the file in a way that Matlab couldn't handle. To avoid such issues in the future, I'd just like to start naming my LaTeX files using best practices.
73437
How can I get the filename from a file path in Ruby?  For example if I have a path of "C:\projects\blah.dll" and I just want the "blah".  Is there a LastIndexOf method in Ruby?
16972
I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a double '/ in the path. I know that bash doesn't care if you have multiple file separators, but I'm wondering how exactly that is rectified. Is it bash that strips extra /s or does it really not matter ever?  I ask because it will save me several lines of code to check for extra /s while concatenating. I know it's not a big deal, but I'm curious as well. I have a bash script that has the line cd //usr (instead of cd /usr), which seems to imply there might be a significance to using multiple /s in a path
19937
I'm working on some scripting:  for x in `find ./ -name *.pdf` do   echo pathname $x done   My filenames are Test1 ( Volume II), Test2 ( Volume II). I'm getting a return of  pathname Test1 pathname ( pathname Volume pathname II …   How do I get it to stay as one variable?
30016
Say I have a variable named choice it is equal to 2. How would I access the name of the variable? Something equivalent to  In [53]: namestr(choice) Out[53]: 'choice'   for use in making a dictionary. There's a good way to do this and I'm just missing it.  EDIT:  The reason to do this is thus. I am running some data analysis stuff where I call the program with multiple parameters that I would like to tweak, or not tweak, at runtime. I read in the parameters I used in the last run from a .config file formated as  filename no_sig_resonance.dat  mass_peak 700  choice 1,2,3   When prompted for values, the previously used is displayed and an empty string input will use the previously used value.  My question comes about because when it comes to writing the dictionary that these values have been scanned into. If a parameter is needed I run get_param which accesses the file and finds the parameter.   I think I will avoid the problem all together by reading the .config file once and producing a dictionary from that. I avoided that originally for... reasons I no longer remember. Perfect situation to update my code!
29874
how to convert batch file from .tif to .bil format using gdal_translate in windows CMD command line, file in the directory.   Directory path : D:\GDAL-TEST 001_mean.tif 002_mean.tif 003_mean.tif 004_mean.tif So on....   I have one code but by this code we can convert single file at a time but i want to loop through all raster which have .tif extension in the  directory and convert it to .bil format. Please want a solution   My code. I a running this code on GDAL Command window on windows 7 platform.      gdal_translate -of "ENVI" D:\GDAL-TEST\001_mean.tif D:\GDAL-TEST\001_mean.bil
69649
I'm using GCC; __FILE__ returns the current source file's entire path and name: /path/to/file.cpp. Is there a way to get just the file's name file.cpp (without its path) at compile time? Is it possible to do this in a portable way? Can template meta programming be applied to strings?  I am using this in an error logging macro. I really do not want my source's full path making its way into the executable.
52778
Per man definition, this command gets the input from a file.  $ command -r FILENAME   Suppose that FILENAME is a file containing a list of filenames, as it was generated using ls &gt; FILENAME.  How can I, instead, feed the command with the result of ls directly? In my head something like this should be possible:  $ ls | command -r  But it doesn't, the output of ls doesn't get hooked as an argument. Output:  Usage: command -r FILENAME error: -r option requires an argument   How could I obtain the desired effect?