有没有办法让vscode explorer跟随终端?Mobaxterm有这样的能力。我通常通过 ssh 进入远程系统,这样的功能是非常理想的。目前,我 cd 到一个目录,然后将路径复制并粘贴到 vscode 中的“打开文件夹”,这需要一些时间。
我知道 clt+click 终端中的路径会打开一个新的 vscode 窗口,但这并不是很有帮助。我感兴趣的资源管理器会自动跟随终端。
我正在尝试通过 ssh 在远程集群上运行 MATLAB。当我在终端中输入 matlab 时,它只会在终端环境中打开 MATLAB 命令行。我的问题是有什么方法可以访问 MATLAB GUI?
我正在尝试使用 combine_by_coords 组合两个空间 xarray 数据集。这两个数据集是彼此相邻的两个图块。所以有重叠的坐标。在重叠区域中,其中一个数据集的变量值为 nan。
我使用了带有 compat='no_conflicts' 选项的“combine_by_coords”。但是,它返回沿维度 y错误的单调全局索引。看起来它以前是一个问题,但已修复(此处)。所以我真的不知道为什么我会收到这个错误。这是一个示例(netcdf 磁贴在这里):
import xarray as xr
print(xr.__version__)
>>>0.15.1
ds1=xr.open_dataset('Tile1.nc')
ds2=xr.open_dataset('Tile2.nc')
ds = xr.combine_by_coords([ds1,ds2], compat='no_conflicts')
>>>...
ValueError: Resulting object does not have monotonic global indexes along dimension y
Run Code Online (Sandbox Code Playgroud)
谢谢
对于多维滚动窗口使用 xarray 滚动构造的最佳方法是什么?这是一个 numpy 示例:
import numpy as np
from numpy.lib.stride_tricks import as_strided
data = np.array(np.arange(6).reshape(2, 3),dtype="float64")
win_size = (
3 # Size of the window (e.g. 3*3)
)
win_size_half = int(np.floor(win_size / 2))
# pad with nan to get correct window for the edges
data = np.pad(
data,
(win_size_half, win_size_half),
"constant",
constant_values=(np.nan),
)
sub_shape = (win_size, win_size)
view_shape = tuple(np.subtract(data.shape, sub_shape) + 1) + sub_shape
data_view = as_strided(
data, view_shape, data.strides * 2
)
data_view = data_view.reshape((-1,) + sub_shape) …Run Code Online (Sandbox Code Playgroud) 我有一个“dataarray”,我正在尝试使用 roxarray 重新投影它。但是,当我使用 xarray.to_netcdf 进行重投影后,保存的文件是一个数据集,其中“spatial_ref”坐标转换为变量。我不确定是 xarray 还是 rioxarray.reprojection 导致了这种行为。以下是一些显示问题的代码:
import xarray as xr
import rioxarray
from pyproj import CRS
lst = xr.open_dataset("lst.nc") # File which carries the original CRS
luc = xr.open_rasterio("luc.tif") # File with the desired projection system
file_to_reproject = xr.open_dataarray("myfile.nc") # File to reproject
cc_lst = CRS.from_cf(lst.crs.attrs) # Get the CRS
cc_luc = luc.rio.crs
file_to_reproject = file_to_reproject.rio.write_crs(cc_lst) # write crs
file_reprojected= file_to_reproject.rio.reproject(cc_luc) #reproject the file
print(file_reprojected)
<xarray.DataArray (season: 4, y: 4343, x: 4172)>
array([[[nan, nan, nan, ..., nan, …Run Code Online (Sandbox Code Playgroud)