QGIS: Difference between revisions

1,311 bytes added ,  6 years ago
added stuff and I don't even know how I created the page in the first place
(created the page)
 
(added stuff and I don't even know how I created the page in the first place)
Line 10: Line 10:
Never make intense use of QGIS on the login nodes! Submit jobs using the command line whenever possible and if you must visualize your data using the GUI, please do so on an interactive node. Using parallel rendering on the shared login nodes will result in the termination of your session.
Never make intense use of QGIS on the login nodes! Submit jobs using the command line whenever possible and if you must visualize your data using the GUI, please do so on an interactive node. Using parallel rendering on the shared login nodes will result in the termination of your session.


== Command-line QGIS ==  
== Loading QGIS ==  
<!--T:3-->
<!--T:3-->
You will first need to load gcc
You will first need to load gcc
Line 49: Line 49:
}}  
}}  


To execute R scripts, use the <tt>Rscript</tt> front-end with the file containing the R commands as an argument:
 
====Command-line QGIS==== <!--T:31-->
You can execute QGIS by running a Python script:


<!--T:16-->
<!--T:16-->
{{Command|Rscript computation.R}}
{{Command|python qgis_code.py}}
 
<!--T:32-->
1. Place your python code in a script file, in this case the [https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html file] is called ''qgis_code.py''.
 
<!--T:33-->
{{File
from qgis.core import *
 
# supply path to qgis install location
QgsApplication.setPrefixPath("/path/to/qgis/installation", True)
 
# create a reference to the QgsApplication, setting the
# second argument to False disables the GUI
qgs = QgsApplication([], False)
 
# load providers
qgs.initQgis()
 
# Write your code here to load some layers, use processing
# algorithms, etc.
 
# When your script is complete, call exitQgis() to remove the
# provider and layer registries from memory
 
qgs.exitQgis()
}}
 
<!--T:34-->
2. Copy the following content in a job submission script called ''job.sh'':
 
<!--T:35-->
{{File
  |name=job.sh
  |lang="bash"
  |contents=
#!/bin/bash
#SBATCH --account=def-someacct  # replace this with your own account
#SBATCH --ntasks=1              # number of MPI processes
#SBATCH --mem-per-cpu=2048M      # memory; default unit is megabytes
#SBATCH --time=0-00:15          # time (DD-HH:MM)
module load gcc
module load qgis
 
python qgis_code.py
}}
 
<!--T:36-->
3. Submit the job with:
 
<!--T:37-->
<source lang="bash">
sbatch job.sh
</source>


<!--T:38-->
For more on submitting jobs, see the [[Running jobs]] page.




cc_staff
56

edits