Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, excuse me, I have a question to ask you. #1

Open
751770645 opened this issue Oct 19, 2022 · 4 comments
Open

Hello, excuse me, I have a question to ask you. #1

751770645 opened this issue Oct 19, 2022 · 4 comments

Comments

@751770645
Copy link

您好,学习您的程序的时候运行报错出现这个问题:self.lon = data.variables['x'][lonstartIndex:lonendIndex]
KeyError: 'x'。想请教一下您,这是什么原因呢?是数据集里不存在这个键吗,谢谢。

@shiningxy
Copy link
Owner

shiningxy commented Oct 19, 2022

下载ETOPO1_Bed_c_gmt4.grd.gz,将该数据集解压至项目根目录,解压后的文件名为ETOPO1_Bed_c_gmt4.grd,md5校验码为a32d72c6d2d475d9f8047d6064d0bf2c

可以通过以下代码查看数据集的变量

import netCDF4 as nc
data = nc.Dataset("ETOPO1_Bed_c_gmt4.grd", "r+")
print(data.variables)

输出为

{'x': <class 'netCDF4._netCDF4.Variable'>
**float64 x(x)**
    long_name: Longitude
    actual_range: [-180.  180.]
    units: degrees_east
unlimited dimensions: 
current shape = (21600,)
filling on, default _FillValue of 9.969209968386869e+36 used, 'y': <class 'netCDF4._netCDF4.Variable'>
**float64 y(y)**
    long_name: Latitude
    actual_range: [-90.  90.]
    units: degrees_north
unlimited dimensions: 
current shape = (10800,)
filling on, default _FillValue of 9.969209968386869e+36 used, 'z': <class 'netCDF4._netCDF4.Variable'>
**int32 z(y, x)**
    long_name: z
    _FillValue: -2147483648
    actual_range: [-10803.   8333.]
unlimited dimensions: 
current shape = (10800, 21600)
filling on}

可以看到该数据集有三个变量,分别是float64类型的x,float64类型的y,和int32类型的z

请尝试以上方法,如果仍有问题,可以继续在issue中向我沟通,谢谢

@751770645
Copy link
Author

751770645 commented Oct 20, 2022 via email

@shiningxy
Copy link
Owner

shiningxy commented Oct 20, 2022

运行完main.py之后,可以得到一个奖励函数的曲线,一个名为Python Turtle Graphics的海龟绘图窗口和一个测试结果曲线。

目前规划路径结果图就是海龟绘图窗口,我保存了一个示例在本项目根目录的img/fig3.gif。代码中并未实现将海龟绘图窗口自动保存为文件的功能。

第一、该绘图窗口方法继承自gym.cliffwalking,我认为它非常古老,并且不美观,所以认为没有必要保存下来

第二、当经纬度跨度过大时,绘制网格线和陆地实心方块时间过长,不是一个可以接受的绘制时间

第三、如果非常想要录制规划路径结果图,可以使用obs studio或其他录屏软件

该项目还处在丰富理论基础和扩展代码实现的阶段,如果您有兴趣,可以与我一同维护本项目代码。

如果本项目对你有帮助,也请为本项目点一个⭐

@nikhil-pillai
Copy link

How can I change the code to work with custom lat and lons. I have a data set with all the lats and lons for each of the grid boxes inside the grid. Can you kindly explain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants