2024年6月26日星期三

mikeio encoding error

 ---------------------------------------------------------------------------

UnicodeEncodeError                        Traceback (most recent call last)
Cell In[16], line 2
      1 for f  in file_lst:
----> 2     df = mikeio.read(f).to_dataframe()

File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\__init__.py:133, in read(filename, items, time, keepdims, **kwargs)
    130 if "dfs" not in ext:
    131     raise ValueError("mikeio.read() is only supported for Dfs files")
--> 133 dfs = open(filename)
    135 return dfs.read(items=items, time=time, keepdims=keepdims, **kwargs)

File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\__init__.py:186, in open(filename, **kwargs)
    180     raise Exception(
    181         f"{ext} is not a supported format for mikeio.open. Valid formats are {valid_formats}"
    182     )
    184 reader_klass = READERS[ext]
--> 186 return reader_klass(filename, **kwargs)

File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\dfs\_dfs0.py:101, in Dfs0.__init__(self, filename)
     98 if not path.exists():
     99     raise FileNotFoundError(path)
--> 101 dfs = DfsFileFactory.DfsGenericOpen(str(path))
    102 self._source = dfs
    104 # Read items

File C:\py_venv\py_leafmap\Lib\site-packages\mikecore\DfsFileFactory.py:84, in DfsFileFactory.DfsGenericOpen(filename, parameters)
     81 @staticmethod
     82 def DfsGenericOpen(filename, parameters = None):
     83     dfs = DfsFile();
---> 84     dfs.Open(filename, DfsFileMode.Read, parameters);
     85     return dfs

File C:\py_venv\py_leafmap\Lib\site-packages\mikecore\DfsFile.py:726, in DfsFile.Open(self, filename, mode, parameters)
    724 # Marshal filename string to C char*
    725 fnp = ctypes.c_char_p()
--> 726 fnp.value = filename.encode("cp1252")
    728 if mode is DfsFileMode.Read:
    729     # Open file for reading
    730     rok = DfsDLL.Wrapper.dfsFileRead(
    731         fnp.value, ctypes.byref(self.headPointer), ctypes.byref(self.filePointer)
    732     )

File ~\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py:12, in Codec.encode(self, input, errors)
     11 def encode(self,input,errors='strict'):
---> 12     return codecs.charmap_encode(input,errors,encoding_table)

UnicodeEncodeError: 'charmap' codec can't encode character '\u5e74' in position 10: character maps to <undefined>
encoding with 'cp1252' codec failed

2024年6月22日星期六

chrome socks5 proxy from cmd

 https://www.chromium.org/developers/design-documents/network-stack/socks-proxy/

To configure chrome to proxy traffic through the SOCKS v5 proxy server myproxy:8080, launch chrome with these two command-line flags:


--proxy-server="socks5://myproxy:8080"


--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE myproxy"


Explanation


The --proxy-server="socks5://myproxy:8080" flag tells Chrome to send all http:// and https:// URL requests through the SOCKS proxy server "myproxy:8080", using version 5 of the SOCKS protocol. The hostname for these URLs will be resolved by the proxy server, and not locally by Chrome.


NOTE: proxying of ftp:// URLs through a SOCKS proxy is not yet implemented.

The --proxy-server flag applies to URL loads only. There are other components of Chrome which may issue DNS resolves directly and hence bypass this proxy server. The most notable such component is the "DNS prefetcher".Hence if DNS prefetching is not disabled in Chrome then you will still see local DNS requests being issued by Chrome despite having specified a SOCKS v5 proxy server.


Disabling DNS prefetching would solve this problem, however it is a fragile solution since once needs to be aware of all the areas in Chrome which issue raw DNS requests. To address this, the next flag, --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE myproxy", is a catch-all to prevent Chrome from sending any DNS requests over the network. It says that all DNS resolves are to be simply mapped to the (invalid) address 0.0.0.0. The "EXCLUDE" clause make an exception for "myproxy", because otherwise Chrome would be unable to resolve the address of the SOCKS proxy server itself, and all requests would necessarily fail with PROXY_CONNECTION_FAILED.

2024年6月21日星期五

nvidia-smi, not enough memory for the allocation

 [ 1484.096449] __vm_enough_memory: pid: 2966, comm: nvidia-smi, not enough memory for the allocation

[ 1484.096456] __vm_enough_memory: pid: 2966, comm: nvidia-smi, not enough memory for the allocation

[ 1484.096457] __vm_enough_memory: pid: 2966, comm: nvidia-smi, not enough memory for the allocation

[ 1500.015549] __vm_enough_memory: pid: 2967, comm: nvidia-smi, not enough memory for the allocation

[ 1500.015558] __vm_enough_memory: pid: 2967, comm: nvidia-smi, not enough memory for the allocation

[ 1500.015560] __vm_enough_memory: pid: 2967, comm: nvidia-smi, not enough memory for the allocation

[ 1520.960394] __vm_enough_memory: pid: 2970, comm: nvidia-smi, not enough memory for the allocation

[ 1520.960402] __vm_enough_memory: pid: 2970, comm: nvidia-smi, not enough memory for the allocation

[ 1520.960403] __vm_enough_memory: pid: 2970, comm: nvidia-smi, not enough memory for the allocation

[ 1732.930913] __vm_enough_memory: pid: 3027, comm: nvidia-smi, not enough memory for the allocation

[ 1732.930919] __vm_enough_memory: pid: 3027, comm: nvidia-smi, not enough memory for the allocation

[ 1732.930921] __vm_enough_memory: pid: 3027, comm: nvidia-smi, not enough memory for the allocation

2024年6月12日星期三

ogr2ogr 使用sql 从 gpkg 中导出属性表

 ogr2ogr   -f   CSV  aa.csv    mdf.gpkg  -sql "select x, y, '1' as code from table002"

ogr2ogr -f CSV out.csv  -sql "select st_x(pt.geom), st_y(pt.geom), '1' as code from Vertices as pt" in.gpkg

ogr2ogr -f CSV out.csv  -sql "select st_x(pt.geom), st_y(pt.geom), pt.marker as code from Vertices as pt" in.gpkg

输出的csv文件中,最后一列,总是被双引号包起来,怎么去掉呢?

添加选项   -lco STRING_QUOTING=IF_NEEDED

https://gis.stackexchange.com/questions/470855

2024年6月11日星期二

qgis 算法

 QGIS/src/analysis/processing/qgsalgorithmlineintersection.cpp