python - UFuncTypeError,我收到此错误。我该如何解决这个问题,以便我可以读取变量
问题描述
运行代码时出现此错误:
UFuncTypeError: ufunc 'multiply' 不包含签名匹配类型的循环 (dtype('<U32'), dtype('<U32')) -> dtype('<U32')
我是 python 和编码的新手,所以我希望在这里提供问题的相关信息。
我可以打印所有其他变量,但是当我尝试打印 WindPower_capacity_factor_monthly 时出现错误。不确定如何从这里处理我的数据。
这是我的代码:
#import matplotlib.pyplot as plt
import numpy as np
#from mpl_toolkits.basemap import Basemap
nc = Dataset('/Users/fredrikvonschlanbusch/Documents/Skole/Master/WindPower_capacity_factor_monthly.nc')
cf = nc['WindPower_capacity_factor_monthly'][:]
print(cf)
nc 看起来像这样:
root group (NETCDF4 data model, file format HDF5):
description: NORwegian hindcast Archive Wind Power data set (NORA3-WP)
institution: Geophysical Institute, Bergen offshore wind centre, University of Bergen, Norway
production: Created using MatLab (version 2018b)
author: Ida M. Solbrekke (email: ida.solbrekke@gfi.uib.no) and Asgeir Sorteberg (email: Asgeir.Sorteberg@uib.no)
date: 15-Aug-2021
dimensions(sizes): X(652), Y(1149), T(288), Z(3), stringlength(15), M(1), methodlength(1000), turbine(3)
variables(dimensions): float64 lon(Y, X), float64 lat(Y, X), float64 projection_lambert(), float64 time(T), float32 hub_heights(Z), |S1 turbine_name(stringlength, Z), float32 turbine_rated_power(Z), float32 turbine_cut_in_wind_speed(Z), float32 turbine_rated_wind_speed(Z), float32 turbine_cut_out_wind_speed(Z), |S1 method(methodlength, M), float32 WindPower_capacity_factor_monthly(T, M, turbine, Y, X)
cf 看起来像这样:
float32 WindPower_capacity_factor_monthly(T, M, turbine, Y, X)
long_name: WindPower_capacity_factor_monthly
standard_name: WindPower_capacity_factor_monthly
units: Percentage (%)
scale_factor: 1
coordinates: lat lon
variable_description: Capacity factor is here the ratio between the monthly generated wind power and the monthly maximum possible wind power output
unlimited dimensions: T
current shape = (288, 1, 3, 1149, 652)
filling on, default _FillValue of 9.969209968386869e+36 used
解决方案
推荐阅读
- mysql - 选择后Mysql查询删除记录..?
- android - 如何在 Crashlytics 中获取 golang 的 Stack-trace
- python - Django rest框架在序列化许多对象时添加更多数据
- asp.net - 我在下拉列表中获得选定的项目值 -1 并且没有显示实际值
- spring-boot - Spring Boot 和 Zuul 出现 404 错误
- angular - 在Angular 6中获取没有@ViewChild装饰器的视图子元素
- functional-programming - 功能惯用的 FFT
- java - 在 Java 中的 Linux 服务器中选择日语时,下载 CSV 文件头会变得垃圾
- jquery - 打开时更改表 tr(th td) 背景颜色
- javascript - 谷歌地图自动完成样式