The main contents of this blog include:
1.WSL environment configuration2. The installation and basic use of libRadtran
1. Configuration of WSL environment
WSL is the linux system of windows. The following mainly introduces how to install WSL:
The official configuration tutorial can refer to this link: https://learn.microsoft.com/zh-cn/windows/wsl/setup/environment1. Open Control Panel -> Programs, turn on Windows Features (enable or disable Windows feature options)


2. Open cmd in administrator mode and check whether wsl has been installed (use wsl -l -v command)

Because I have installed ubantu's wsl environment, there is output. If it is not installed, the following window will appear:

3. To install wsl, we can download and install directly through the Microsoft store, search for ubantu, and then choose the version you want to install (version 20.04.5 is recommended, the latest version 22 is not recommended, and there are still many bugs)

Opening after downloading will load the data

Open it after installation, we will be asked to enter a new user name and password to create a user, the password is invisible after entering, and then it looks like the picture below

You can also set the mirror source of wsl. Readers who are interested can find relevant information by themselves, so I won’t introduce it here
4. Configure the development environment of vscode+wsl
First, let's go to the vscode official website to download and install vscode:
Official website link: https://code.visualstudio.com/

After downloading and installing, just keep next without thinking. Of course, this is without modifying the installation path. If you need to customize the installation path, remember to modify it during the installation process.
Then we open vscode and download the WSL plugin:

Finally, we open the ubantu terminal and enter code .


If ubantu appears in the lower left corner, it means that we are linked to the linux subsystem of ubantu

2. Install libRadtran
The installation process is basically the same as my last tweet. This time I will briefly introduce the process without going into details.First, you need to download all the installation packages needed to install libRadtran:
The installation mainly needs to install make,gcc,gfortran, etc., among which make,gcc,gfortran, etc. can be installed using the sudo apt-get install xxx command, and GSL,zlib,hdf5,curl,netcdf-c,netcdf need to be installed manually -fortran and libRadtran, the protagonist of this tweet.
**The following is an installation introduction in two parts:
1. The part of using apt to install
2. Manual installation part **
Do you think it will be installed directly later, of course not, first we need to modify the python version of wsl, because the default Python version of ubantu20 version is python3, but the python code of libRadtran uses python2 version, For specific switching steps, please refer to this blog:https://blog.csdn.net/My_CSDN_IT/article/details/114323834
1. The part of using apt to install
Here are the installation commands for all parts that can be installed using apt:
sudo apt-get install make sudo apt install build-essential sudo apt-get install gfortran sudo apt-get install flex bison sudo apt install perl
2. The part of manual installation
The commands for manual installation in the following content are all entered in the terminal of wsl-ubantu

First install GSL: . GSL download address

installation steps:
Enter gsl The directory where it is located is decompressed: tar –xvf gsl-2.7.tar.gz Enter the decompressed directory: cd gsl-2.7 Start compiling:./configure --prefix=/opt/netcdf(This is the folder created above, which can be modified according to the actual situation, and the following software installation path is also the same) make make install
Install zlib: zlib Home Site
installation method:
Enter zlib The directory where it is located is decompressed: tar –xvf zlib-1.2.11.tar.gz Enter the decompressed directory: cd zlib-1.2.11 Start compiling:./configure --prefix=/opt/netcdf make make install
Install hdf5:. Download HDF5® - The HDF Group
installation method:
tar -xvf hdf5-1.10.1.tar.gz cd hdf5-1.10.1 ./configure --with-zlib=/opt/netcdf --prefix=/opt/netcdf make make install
Install curl:. curl - Download
installation method:
Below we are about to install netcdf-c and netcdf-fortran, but before installing these two, it is best to set the environment variables first, the setting method is as follows:tar -xvf curl-7.55.1.tar.gz cd curl-7.55.1 ./configure --with-zlib=/opt/netcdf --prefix=/opt/netcdf make make install
First set the system environment variable: vim ~/.bashrc Move the cursor to the last line and insert the following environment variables: export NETCDF=/opt/netcdf(This is the installation path created earlier) export PATH=${NETCDF}/bin:$PATH export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH} export LD_RUN_PATH=${NETCDF}/lib:${LD_RUN_PATH} export CPPFLAGS=-I/opt/netcdf/include export LDFLAGS=-L/opt/netcdf/lib After copying and pasting, press<ESC>key to exit editing, enter ": wq"exit save; source ~/.bashrc Make the environment variable take effect.
Install netcdf-c:. NetCDF
installation steps:
tar -xvf netcdf-c-4.8.0.tar.gz cd netcdf-c-4.8.0 ./configure --prefix=/opt/netcdf ##If the above compilation command reports an error, it can be replaced with the following command ##./configure --prefix=/opt/netcdf LDFLAGS=-L/opt/netcdf/lib CPPFLAGS=-I/opt/netcdf/include make make install
Install netcdf-fortran:. NetCDF-fortran
installation method:
tar -xvf netcdf-fortran-4.5.3.tar.gz cd netcdf-fortran-4.5.3 ./configure --prefix=/opt/netcdf ##If the above compilation command reports an error, it can be replaced with the following command ##./configure --prefix=/opt/netcdf LDFLAGS=-L/opt/netcdf/lib CPPFLAGS=-I/opt/netcdf/include make make install
Install libRadtran
Find a location, create a new folder named libradtran2.0.4 (folder name can be specified by yourself) (command line: mkdir ibradtran2.0.4), and then install the software to this directory
installation steps:
1,Unzip: tar -xvf libradtran-2.0.4.tar.gz 2,Compile and install: cd libRadtran-2.0.1 ./configure --prefix=/opt/libradtran2.0.1 make make install Check if the installation is complete: make check
Finally, for the convenience of operation, we set some environment variables under individual users:
Open the environment variables of ordinary users: vim ~/.bashrc (note that .bashrc is a hidden file, if you want to view this file, you can use "`ls –
a` View") In the last line of .bashrc, add the following lines of settings:
export LIBRAD=/opt/libradtran2.0.4(This can be changed to the reader himself libRadtran installation path, be sure to pay attention to the case of the file name) export DATA=${LIBRAD}/share/libRadtran/data export INP=${LIBRAD}/share/libRadtran/examples export PATH=${LIBRAD}/bin:$PATH export LD_LIBRARY_PATH=${LIBRAD}/lib:${LD_LIBRARY_PATH} export LD_RUN_PATH=${LIBRAD}/lib:${LD_RUN_PATH}
Exit and save, source ~/.bashrc to make the environment change take effect.
At this point, the installation of libRadtran in wsl is complete. Now we can use the terminal of wsl to enter code . to open vscode to write and process related files.

We can view the sample file of libRadtran in libRadtran2.0.4 as shown in the figure below, and we can also write the INP file

If you want to run the INP file, switch to the libRadtran-2.0.4/examples path, and then enter uvspec <xxx.INP> xxx.out in the wsl terminal.

So far, the content of this blog post has been introduced. If you have any questions, you can communicate with private messages. The software can be obtained by replying to [libradtran] in the background of the official account [Programmer’s Additional Issue Log].