2025年1月15日星期三

python 环境变量

what-exactly-should-be-set-in-pythonpath
  •  PYTHONHOME

Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local.


When PYTHONHOME is set to a single directory, its value replaces both prefix and exec_prefix. To specify different values for these, set PYTHONHOME to prefix:exec_prefix.


  • PYTHONPATH

Augment the default search path for module files. The format is the same as the shell’s PATH: one or more directory pathnames separated by os.pathsep (e.g. colons on Unix or semicolons on Windows). Non-existent directories are silently ignored.


In addition to normal directories, individual PYTHONPATH entries may refer to zipfiles containing pure Python modules (in either source or compiled form). Extension modules cannot be imported from zipfiles.


The default search path is installation dependent, but generally begins with prefix/lib/pythonversion (see PYTHONHOME above). It is always appended to PYTHONPATH.


An additional directory will be inserted in the search path in front of PYTHONPATH as described above under Interface options. The search path can be manipulated from within a Python program as the variable sys.path.

pyqgis

1 开发环境配置


@echo off
SET OSGEO4W_ROOT=C:\OSGeo4W
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\apps\grass\grass83\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\grass\grass83\lib
path %PATH%;C:\OSGeo4W\apps\Qt5\bin
path %PATH%;C:\OSGeo4W\apps\Python312\Scripts

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python312

set PATH=C:\Program Files\Git\bin;C:\Users\27096\AppData\Local\Programs\Microsoft VS Code;%PATH%

cmd.exe


C:\qgis_dev>python3 -c "import sys;print(sys.path)"
['', 
'C:\\aka\\my_git\\qgis_dev', 
'C:\\OSGeo4W\\bin',
'C:\\OSGeo4W\\bin\\python312.zip', 
'C:\\OSGeo4W\\apps\\grass\\grass83\\etc\\python', 
'C:\\OSGeo4W\\apps\\qgis\\python', 
'C:\\OSGeo4W\\apps\\Python312\\DLLs', 
'C:\\OSGeo4W\\apps\\Python312\\Lib', 
'C:\\OSGeo4W\\apps\\Python312', 
'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\Pythonwin'
]
上面的列表为了美观,顺序调整过,下面是原始输出:
[
'', 
'C:\\OSGeo4W\\apps\\grass\\grass83\\etc\\python', 
'C:\\aka\\my_git\\qgis_dev', 
'C:\\OSGeo4W\\apps\\qgis\\python', 
'C:\\OSGeo4W\\bin\\python312.zip', 
'C:\\OSGeo4W\\apps\\Python312\\DLLs', 
'C:\\OSGeo4W\\apps\\Python312\\Lib', 
'C:\\OSGeo4W\\bin', 
'C:\\OSGeo4W\\apps\\Python312',
 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python312\\Lib\\site-packages\\Pythonwin']

为什么存在  "C:\OSGeo4W\bin\python.exe"
这个文件有什么用?

  • OSGeo4W Shell ----->   C:\OSGeo4W\OSGeo4W.bat  
  • GRASS GIS 8.3.2------>  C:\OSGeo4W\bin\grass83.bat --gui
  • QGIS Desktop 3.36.3 ------>  C:\OSGeo4W\bin\qgis-bin.exe
  • Qt Designer with QGIS 3.36.3 custom widgets  ----> C:\OSGeo4W\bin\bgspawn.exe "C:\OSGeo4W\bin\qgis-designer.bat"
  • Setup  ---->  C:\OSGeo4W\bin\bgspawn.exe "C:\OSGeo4W\bin\setup.bat"
  • SAGA GIS 9.3.1  ---->  C:\OSGeo4W\bin\bgspawn.exe "C:\OSGeo4W\bin\saga_gui.bat"
uses bgspawn to the batch jobs, which has the advantage that there is no command line window flashing up when a desktop application starts.

2025年1月14日星期二

pyqt

 1、pyqt6

2、pyside6

2025年1月12日星期日

scp

youtube

  1.  https://github.com/yt-dlp/yt-dlp
  2. yt-dlp:  how-do-i-pass-cookies-to-yt-dlp
  3. https://github.com/yt-dlp/yt-dlp/issues/7271
  4. https://github.com/ytdl-org/youtube-dl/issues/33006
  5. https://github.com/yt-dlp/yt-dlp/issues/10927
  6. https://github.com/yt-dlp/yt-dlp#network-options
  7. Get cookies.txt LOCALLY
  8. C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\Network
  9. yt-dlp.exe  --proxy socks5://127.0.0.1:10808/  --cookies   www.youtube.com_cookies.txt   https://youtu.be/xxxxxxxxxxxxx

sql rowid

qgis Virtual layers

sql示例:

SELECT gch.rowid as id, gch.geometry as geometry,  gch.L2, gcq.L3, gch.L2 - gcq.L3 as delta_L
FROM  gch
JOIN    gcq 
ON gch.rowid = gcq.rowid;


C#

1、SDK


2、.NET Interactive

3、Using .NET Interactive as a Jupyter kernel

  • NotebookswithJupyter     
  • 命令:dotnet tool install -g Microsoft.dotnet-interactive
  • 命令:dotnet-interactive
  • 在conda 环境中,命令:dotnet interactive jupyter install
  • 更新命令:dotnet tool update -g Microsoft.dotnet-interactive

4、使用

  • magic-commands.md
  • #i     Adds a NuGet source to the session
  • #r     adds a reference to a specified assembly

2025年1月10日星期五

DHI Mike zero 辅助软件

1、mike11

  1. 结果提取:①异常检测;②水位提取;③流量提取;④
  2. 断面数据转换

2、mike21

  1. mdf文件
  2. mesh文件:①mesh文件对比;②mesh文件局部修改
  3. 线状物插值
  4. 结果提取:①dfsu文件极值提取;②dfsu文件分割

3、批量计算

2025年1月9日星期四

powershell:PSReadLine

  1.  https://github.com/PowerShell/PSReadLine
  2. 在 PSReadLine 中使用预测器
  • PSReadLine 2.1.0 引入了预测性 IntelliSense 功能
  • PSReadLine 2.2.6 默认启用预测
  • RightArrow 键接受内联建议,再按 Enter 运行命令
  • F2 键在 InlineViewListView 之间进行切换
  • 使用 Set-PSReadLineOptionPredictionViewStyle 参数来更改视图

powershell fzf

  1. 使用管理员权限是必须的吗?
  2. 必须设置代理才能安装吗?
  3. Get-Alias
  4. Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
  5. Find-Module -Name PSReadLine -Repository PSGallery | Get-Member
  6. Install-Module -Name PowerShellGet -Force
  7. Install-Module PSReadLine -AllowPrerelease -Force
  8. Install-Module -Name PSFzf 
  9. winget install fzf

2025年1月7日星期二

git push

 C:\MDAL> git push

Username for 'https://github.com': user007

Password for 'https://user007@github.com':

Everything up-to-date


从master分支切换到mike21_mesh_optimize分支


C:\MDAL> git status

On branch mike21_mesh_optimize

nothing to commit, working tree clean


C:\MDAL> git push

fatal: The current branch mike21_mesh_optimize has no upstream branch.

To push the current branch and set the remote as upstream, use


    git push --set-upstream origin mike21_mesh_optimize


To have this happen automatically for branches without a tracking

upstream, see 'push.autoSetupRemote' in 'git help config'.

2025年1月6日星期一

mike21fm 工程文件中的 Minimum depth cutoff


注意:如果建立工程文件后,手动修改了mesh文件,该值不会自动更新。

If the bathymetry level in an element is above the minimum depth cutoff value then the minimum depth cutoff value is replacing the actual bathymetry value in the computations. Please note that the minimum depth cutoff value may be negative as the bathymetry levels is often so in the mesh file. 

If you also apply a Datum shift - the depth cutoff is relative to the corrected depths. 

For instance - you have a mesh file with values between +2 and -20 meters. You then shift these to a different datum with a shift of +1 meters. Your corrected bathymetry now ranges between +1 and -21 m. You can then cutoff all depths above -2m, leaving the bathymetry used in the model to range between -2 and -21 m. 


关于mike21的Culvert

  1.  Culvert location 会封堵所在位置
  2. 推测:①culvert 的长度,可能只用来取水位;②取水位后,计算流量;③把计算的流量均匀分布到culvert location 所在的line上
  3. 疑问:若能根据水位计算流量,但culvert location所在的网格的高程,明显高于周边水位,计算会出错。(也就是说:如果网格本身的高程造成阻水,想通过culvert将流路打通,是无法实现的)

2025年1月2日星期四

neovim: Highlight Yanked Region

https://neovim.io/doc/user/lua.html#vim.hl

https://www.reddit.com

https://jdhao.github.io/2020/05/22/highlight_yank_region_nvim/

mdal存在的问题

1、MDAL::DriverMike21::load( )加载数据太慢

         原因:使用正则表达式分析数据造成 regex_split

2、加载大的Mike21 mesh文件会出错

      加载“计算库容用2019-08-25.mesh”这个文件,在Windows下会出错,奇怪的是,在Linux里就不会出错。

3、使用conda命令安装mdal,为什么mdal.dll没有被安装到虚拟环境中,从conda-meta目录里的mdal-1.2.0-hd0e7f6f_0.json可以查到安装到了哪里。

4、python-mdal是怎么找到mdal.dll的?

cmake学习

  1.  https://github.com/atrelinski/CMake-Example/tree/master
  2. https://github.com/aka863/MDAL
  3. https://github.com/buildaworldnet/IrrlichtBAW/issues/194
  4. https://juejin.cn/post/7157628526060011527
  5. how-can-i-use-cmake-to-create-a-visual-studio-solution-with-multiple-visual-stud
  6. cmake-exe-cant-find-dll
  7. https://www.cnblogs.com/zjacky/p/17088203.html
  8. https://github.com/BoomingTech/Piccolo/issues/130
  9. https://blog.csdn.net/zyw1120172694/article/details/120888157

cmake  -G   "Visual Studio 16 2019"     -DCMAKE_BUILD_TYPE=Release   ..


cmake -H. -Bbuild
This will create build directory and solution (*.sln) in it. 
Then run cmake --build build --config Release in windows command line to compile.