Thursday, March 27, 2025

How to install HYSPLIT on Windows

在安装HYSPLIT之前,需要先安装Tcl/Tk和ImageMagick。
Before installing HYSPLIT, you need to install Tcl/Tk and ImageMagick first.

Tcl/Tk

打开Air Resources Laboratory - HYSPLIT Graphical Utilities,直接单击下图红框的链接,开始下载tcl.zip,下载后解压,并将整个文件夹放在你希望的地方,我一般放在C盘之下某个文件夹之下。
Open the "Air Resources Laboratory - HYSPLIT Graphical Utilities" page and click the link in the red box shown below to download tcl.zip. After downloading, extract the files and place the entire folder wherever you prefer — I usually place it in a subfolder under the C drive.

ImageMagick

继续在Air Resources Laboratory - HYSPLIT Graphical Utilities,单击下图红框的链接。
Still on the Air Resources Laboratory - HYSPLIT Graphical Utilities page, click the link in the red box shown below.
在新页面继续单击下方红框处的链接,选择最新版的软件。
On the new page, click the link in the red box again to select the latest version of the software.
在新打开的页面,找到Windows Binary Release之下,选择ImageMagick-XXXXXXX-dll.exe下载。
On the newly opened page, find the section titled Windows Binary Release, and select ImageMagick-XXXXXXX-dll.exe to download.
下载后,双击开始安装,安装在默认位置即可,当出现下图所示窗口时,务必选择两处,直至安装完毕。
After downloading, double-click the file to begin installation. Install it in the default location. When the window shown below appears, make sure to check both options before proceeding, and continue until the installation is complete.

HYSPLIT

参考Air Resources Laboratory - HYSPLIT Registration Instructions,该软件含有注册版本与非注册版本,注册版本仅多一个Forecast功能。一般,我们先安装非注册版本,注册版本根据需求来选择。打开HYSPLIT for Windows - Public (unregistered) Version Download,填写自己的邮箱即可开始下载。来到了下载列表,一般我选择最新版的.zip版本下载,解压后将其放在合适的位置即可使用。
According to the Air Resources Laboratory - HYSPLIT Registration Instructions, the software includes both a registered and an unregistered version. The registered version only provides one additional feature — Forecast.
Generally, we start by installing the unregistered version, and the registered version can be used as needed.
Go to the HYSPLIT for Windows - Public (unregistered) Version Download page, enter your email address to begin the download.
Once you reach the download list, it's recommended to download the latest .zip version. After downloading, extract the files and place them in a suitable location — the software is then ready to use.
Unzip the file and move the HYSPLIT folder and everything therein to the C: drive. The end result should have directories C:\HYSPLIT\exec, C:\HYSPLIT\working, and others. Then create the "Run Hysplit" shortcut on your desktop. To create the shortcut, open Windows Explorer and navigate to the C:\HYSPLIT\guicode directory. Right-click the hysplit.tcl file and then choose "Send To > Desktop (Create shortcut)." Rename the created shortcut to "Run Hysplit."
我们还需要另外一个路径,找到之前存放Tcl/Tk位置,找到其完整路径(XXXXXX\tcl\bin\wish86t.exe)并复制。
We also need another path: locate the folder where you previously saved Tcl/Tk, find the full path to wish86t.exe (e.g., `XXXXXX\tcl\bin\wish86t.exe`), and copy it.
回到刚刚在Desktop创建的"Run Hysplit",右键找到Properties,在Target里面加入刚刚找到的路径,注意两个路径在一起,并有一个空格分开,最后单击OK完成。
Then, go back to the "Run Hysplit" shortcut you just created on your Desktop, right-click it and select Properties. In the Target field, add the path you just copied after the existing path. Make sure the two paths are separated by a space. Finally, click OK to save the changes.
双击"Run Hysplit",就可以运行了。
Now, double-click "Run Hysplit" to launch the program.

Test the Installation with GUI

如图所示打开Contour Map,并在新窗口按照下图所示配置测试数据,最终单击“Run CONTOUR”。
As shown in the figure, open Contour Map, and in the new window, configure the test data as illustrated. Finally, click "Run CONTOUR".
如果返回如下图的结果,就表示安装成功了。
If you get a result like the one shown below, it means the installation was successful.

References

  1. HYSPLIT - Wikipedia
  2. Air Resources Laboratory - HYSPLIT - Hybrid Single Particle Lagrangian Integrated Trajectory model
  3. HYSPLIT Basic Tutorial Contents ©

Monday, March 24, 2025

Matlab: 本地部署Deepseek,对话模式

一、下载Ollama,修改默认安装路径
二、本地部署模型
三、MATLAB安装LLMs
四、Matlab检测代码

一、下载Ollama,修改默认安装路径

Ollama 是一个可以让你使用并管理 AI 模型的工具,相当于 R1 的承载器具,因此我们在本地部署模型前必须先安装 Ollama。打开 「Ollama 官网:」https://ollama.com/,点击“Download”。
选择适合你电脑的版本,例如“「Windows」”点击“「Download for Windows」”。
安装到指定的路径
下载完成后,双击安装,默认会装到C盘。通过如下方式修改,举例:我想安装在D:\Ollama
  1. 把下载的安装包放在D:\Ollama下
  2. 在D:\Ollama下,打开cmd,输入此命令敲回车即可 OllamaSetup.exe /DIR="D:\Ollama"
  3. 此时就可以看到Ollama被安装到指定路径了。(如果你下载完直接点了安装,也不用担心,直接控制面板程序卸载,卸载了,重新安装即可)

二、本地部署模型

  1. 部署之前,增加环境变量
  2. 增加这个环境变量的话,下载的模型会存储在此,避免占用C盘内存。 注意:增加后,重启电脑以确保生效。
  3. 本地部署deepseek模型
  4. 在cmd下输入命令③代码,即可安装。

      三、MATLAB安装LLMs

      打开网页,添加此到当前Matlab。

      四、Matlab检测代码

      第一步,现在cmd里面运行部署的模型ollama run deepseek-r1:14b。
      第二步,matlab中运行:file

      References

Wednesday, March 12, 2025

Matlab: Wind Rose

风速玫瑰图的制作参考“风向频率玫瑰图”,各风向的风速代表该方向的平均风速。风速玫瑰如下图。数据中0°表示静风,360°表示正北风。
The creation of the wind speed rose diagram follows the wind direction frequency rose diagram, where the wind speed for each direction represents the average wind speed in that direction. The wind speed rose diagram is shown below. In the dataset, 0° represents calm wind, while 360° indicates due north wind.
风向频率玫瑰图的制作参考“风向玫瑰图”,所不同的是这个玫瑰图有37个风向,分别是0:10:360,0°表示静风,360°是为正北风。测试数据的制图结果如下图,静风频率位于下图的中间,一个红边的圆形,例子中的这个静风频率太小了,所以看起来是一个红点。
The creation of the wind direction frequency rose diagram is based on the wind rose diagram, but with a key difference: this diagram includes 37 wind directions, ranging from 0° to 360° in 10° increments. In this dataset, 0° represents calm wind, while 360° indicates due north wind. The plotted results for the test data are shown below. The calm wind frequency is represented by a red-bordered circle in the center of the diagram. In this example, the calm wind frequency is very low, so it appears as a red dot.
The combination of wind frequency, wind direction, and wind speed.

Monday, March 3, 2025

Matlab: Export the selected polygons from the Shapefile

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
% Shp Path
shppath='NFDB_poly_20210707.shp';
S = readgeotable(shppath);
[~, prjname, ~]=fileparts(shppath);
prjpath=[prjname, '.prj'];

% Example: Select polygons where 'LandType' is 'Forest' and 'Area' > 1000
selected_rows = S(S.SRC_AGENCY == "MB" & S.YEAR ==2017, :);


% Loop
for ii=5:10
    rows=selected_rows(selected_rows.MONTH==ii, :);


    otpath=2017*100+ii;
    copyfile(prjpath, [num2str(otpath), '.prj']);
    otpath=[num2str(otpath), '.shp'];

    shapewrite(rows, otpath);
    

end

Wednesday, February 26, 2025

Data: Purple Air Data

File. V2
  1. https://www2.purpleair.com/
  2. https://api.purpleair.com/#api-sensors-get-sensors-data

Monday, February 17, 2025

Matlab: Batch Mapping

This program requires all images and shapefiles to be in a **Geographic Coordinate System**.
Mapping with a large number of latitude and longitude points.