This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
other:newppl:starting [2022/11/18 14:36] jypeter [Text editors] |
other:newppl:starting [2023/02/01 16:38] jypeter [NetCDF and file formats] Improved the section |
||
---|---|---|---|
Line 445: | Line 445: | ||
<note important>A //jupyter notebook// is **not** a text editor! | <note important>A //jupyter notebook// is **not** a text editor! | ||
- | You need a correct text editor to efficiently work with scripts and programs</note> | + | **You need a correct text editor to efficiently work with scripts and programs** |
- | There are **lots** of text editors used on Linux computers/servers (vi, vim, gvim, emacs, nano, ...), that you can use: | + | {{ :other:newppl:real_programmers.png?direct&600 |}} [[https://www.explainxkcd.com/wiki/index.php/378:_Real_Programmers|xkcd & Real Programmers]]</note> |
- | * in basic text terminals (if you know the basic commands and shortcuts) | + | |
- | * or in graphics mode (you may need to have an [[other:x_conf|X server configured]]) | + | |
- | === emacs === | + | There are **lots of text editors available** on Linux computers/servers (''emacs'', ''nano'', ''vi'', ''vim'', ''gvim'', ''gedit'', ...). You can use them: |
+ | * In basic **text terminals** | ||
+ | * useful if you are in a hurry, and/or working on a remote server with a bad network connection or have no local [[other:x_conf|X server]] running | ||
+ | * you should know the basic commands and shortcuts! Some text editors (e.g ''nano'') fortunately display some help at the bottom of the screen | ||
- | {{ :other:newppl:real_programmers.png?direct&600 |}} | + | * With a **full Graphical User Interface** (aka //GUI//) allowing you to use the mouse+menus/buttons/etc... |
+ | * you will need to have a //local// [[other:x_conf|X server]] running, if you want to use the text editor GUI on a //remote// server | ||
- | * Starting emacs: | + | === emacs === |
- | * ''emacs some_text_file &'' | + | |
- | * or just ''emacs &'' | + | |
- | * All the basic functions of emacs are available from the pull-down menus at the top, but the **real power** comes from knowing the keyboard shortcuts! | + | |
- | * **Bonus!** Many emacs shortcuts can be used in the shell or in Python, and will also make it possible to use emacs in text mode (if you get lost on a remote server without graphics...) | + | |
- | * Understanding keyboard shortcuts: ''C-s'' (''CTRL-s'') means //Search forward// and ''M-f'' (''Alt-f'' on a regular keyboard) means //Move forward a word// | + | |
- | * Built-in emacs tutorial. **Highly recommended!** Spend one hour in the tutorial, and save hundreds of hours in the rest of your life! | + | |
- | * ''Help''=>''Emacs Tutorial'' | + | |
- | * or ''Help''=>''Emacs Tutorial (choose language)...'' | + | |
- | * Annotated reference card: {{:other:newppl:emacs_jyp.pdf}} | + | |
- | * Example (recommended) {{:other:emacs_linux_150806.tar|.emacs configuration file}} | + | |
- | * Location: ''~/.emacs'': ''.emacs'' (//dot-emacs// file in your home directory) | + | |
- | * **Editing remote text files** with emacs and the ''tramp'' mode: | + | |
- | * Use the {{:other:emacs_linux_150806.tar|recommended .emacs file}} or activate ''tramp'' by adding the following lines to your own ''~/.emacs'' configuration file | + | |
- | * <code>;; tramp mode configuration | + | |
- | ;; http://www.emacswiki.org/emacs/TrampMode | + | |
- | (require 'tramp) | + | |
- | ;(setq tramp-default-method "ssh") | + | |
- | (setq tramp-default-method "sshx")</code> | + | |
- | * Open/save remote files with: ''/user@server:/path/file''\\ e.g. ''/jypeter@ssh1.lsce.ipsl.fr:/home/users/jypeter/.emacs'' | + | |
- | * Use the built-in psy to solve your problems (with ''M-x doctor'')\\ <code>I am the psychotherapist. Please, describe your problems. Each time | + | |
- | you are finished talking, type RET twice. | + | |
- | My climate model does not work | + | <note important>Read the **dedicated [[other:emacs_doc|Using emacs]] page**, and become a power user!</note> |
- | Why do you say your climate model does not work? | ||
- | I get wrong results | ||
- | |||
- | Is it because of your plans that you say you get wrong results?</code> | ||
- | * {{:other:emacs_win_7_64_140408.zip|for Windows}}, with [[other:win7apps#gnu_emacs_gnuwin_diffutils|emacs for Windows]] | ||
=== vi (vim, gvim) === | === vi (vim, gvim) === | ||
Line 491: | Line 467: | ||
* [[https://www.atmos.albany.edu/daes/atmclasses/atm350/vi_cheat_sheet.pdf|vi cheat sheet]] | * [[https://www.atmos.albany.edu/daes/atmclasses/atm350/vi_cheat_sheet.pdf|vi cheat sheet]] | ||
* [[https://web.mit.edu/merolish/Public/vi-ref.pdf|vi reference card]] | * [[https://web.mit.edu/merolish/Public/vi-ref.pdf|vi reference card]] | ||
- | ==== NetCDF and file formats ==== | + | |
+ | === Notepad++ === | ||
+ | |||
+ | [[other:win10apps#notepad|Notepad++]] is a nice and powerful text editor for **Windows**, but it is also very easy to [[other:emacs_doc#windows_installation|install emacs on Windows]] | ||
+ | ==== NetCDF and related Conventions ==== | ||
+ | |||
+ | === Super-short introduction to NetCDF === | ||
* What are binary ({{:other:newppl:binaire_jyp.pdf}}) and NetCDF ({{:other:newppl:netcdf_jyp.pdf}}) files? | * What are binary ({{:other:newppl:binaire_jyp.pdf}}) and NetCDF ({{:other:newppl:netcdf_jyp.pdf}}) files? | ||
Line 498: | Line 480: | ||
* The NetCDF file format is **self-documented**, and the metadata of climate data files often follows the [[http://cfconventions.org/|CF (Climate and Forecast) Metadata Conventions]] | * The NetCDF file format is **self-documented**, and the metadata of climate data files often follows the [[http://cfconventions.org/|CF (Climate and Forecast) Metadata Conventions]] | ||
* The files in the [[https://esgf-node.ipsl.upmc.fr/projects/esgf-ipsl/|CMIPn (n ≥ 5) database]] are written with the [[https://cmor.llnl.gov/|CMOR 3 library]] in order to make sure that they follow exactly the requested standards | * The files in the [[https://esgf-node.ipsl.upmc.fr/projects/esgf-ipsl/|CMIPn (n ≥ 5) database]] are written with the [[https://cmor.llnl.gov/|CMOR 3 library]] in order to make sure that they follow exactly the requested standards | ||
- | * You can use [[other:win7apps#panoply|Panoply]] and [[http://meteora.ucsd.edu/~pierce/ncview_home_page.html|ncview]] for visualizing quickly the NetCDF files | + | |
- | * [[https://code.zmaw.de/projects/cdo/wiki/Cdo#Documentation|Climate Data Operators]] for manipulating NetCDF files (and some other formats) | + | |
- | * [[http://nco.sourceforge.net/#RTFM|netCDF Operator (NCO)]] for manipulating NetCDF files | + | === Some ways of working with NetCDF without programming === |
- | * [[http://cfconventions.org/|NetCDF CF (Climate and Forecast) Metadata Conventions]]: this will help you understand the information you get when you do a ''ncdump -h some_climate_data_file.nc'' | + | |
- | * Using Python to work with NetCDF data: | + | * Displaying the content of a NetCDF file in a text format\\ Check the ''ncdump'' [[https://docs.unidata.ucar.edu/nug/current/netcdf_utilities_guide.html#ncdump_guide|options]]. People usually want to quickly check the metadata, and use other programs to work with the actual data |
- | * Using the [[http://uv-cdat.llnl.gov/documentation/cdms/cdms.html|cdms2]] module if you work with the [[other:python:starting#uv-cdat|UV-CDAT distribution]] | + | * ''ncdump some_climate_data_file.nc'': dump the full content to text |
- | * Using the [[http://unidata.github.io/netcdf4-python/|netCDF4]] module | + | * ''ncdump -h some_climate_data_file.nc'': only display the metadata |
+ | * You can use [[other:win7apps#panoply|Panoply]] and [[http://meteora.ucsd.edu/~pierce/ncview_home_page.html|ncview]] for quickly visualizing NetCDF files | ||
+ | * Manipulating NetCDF files: | ||
+ | * [[https://code.zmaw.de/projects/cdo/wiki/Cdo#Documentation|Climate Data Operators]] (''cdo'') | ||
+ | * [[http://nco.sourceforge.net/#RTFM|netCDF Operator]] (//NCO// operators) | ||
+ | |||
+ | |||
+ | === NetCDF related Conventions === | ||
+ | |||
+ | * [[http://cfconventions.org/|NetCDF CF (Climate and Forecast) Metadata Conventions]] | ||
+ | * [[https://ugrid-conventions.github.io/ugrid-conventions/|UGRID Conventions]] for storing unstructured (or flexible mesh) model data | ||
+ | * [[http://sgrid.github.io/sgrid/|SGRID Conventions]] for storing staggered data on structured grids that are consistent with the UGRID conventions | ||
+ | |||
+ | === Using NetCDF with Python === | ||
+ | |||
+ | |||
+ | Check the [[other:python:jyp_steps#using_netcdf_files_with_python|dedicated section]] of the //Python// page | ||
==== Programming languages ==== | ==== Programming languages ==== |