- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
测量海浪周期的变量的“单位”属性以“秒”为单位。这不是日期时间字段,但 xarray 会自动将此变量作为 timedelta64 摄取。由于单位不是“自...以来的秒数”,我会假设 xarray 应该将其视为普通的 float32 数据数组,但显然不是这样。我有没有办法告诉 xarray 将波周期变量作为 float32 摄取,或者在摄取后将它们从 timedelta64 转换回原始值?我仍然希望它将“时间”变量转换为 timedelta64,所以我不想关闭整个数据集的翻译,只是针对特定变量(Tper、sper、wper)。
这是我在 TDS 服务器中根据波浪预报使用的基本 OPeNDAP URL:
建议?谢谢!
您可以在此处使用 OPeNDAP 页面查看类似“ncdump”的输出:
或者您可以像这样在 OPeNDAP URL 上运行 ncdump:
结果如下:
netcdf WaveWatch_III_Hawaii_Regional_Wave_Model_best {
dimensions:
lat = 101 ;
lon = 141 ;
time = 54453 ;
z = 1 ;
variables:
float lon(lon) ;
lon:units = "degrees_east" ;
lon:long_name = "longitude" ;
lon:standard_name = "longitude" ;
lon:short_name = "lon" ;
lon:axis = "x" ;
lon:_CoordinateAxisType = "Lon" ;
float lat(lat) ;
lat:units = "degrees_north" ;
lat:long_name = "latitude" ;
lat:standard_name = "latitude" ;
lat:short_name = "lat" ;
lat:axis = "y" ;
lat:_CoordinateAxisType = "Lat" ;
float z(z) ;
z:units = "meters" ;
z:long_name = "depth below mean sea level" ;
z:standard_name = "depth" ;
z:short_name = "depth" ;
z:axis = "z" ;
z:_CoordinateAxisType = "Height" ;
double time(time) ;
time:long_name = "Forecast time for ForecastModelRunCollection" ;
time:standard_name = "time" ;
time:calendar = "proleptic_gregorian" ;
time:units = "hours since 2011-06-21 00:00:00.000 UTC" ;
time:missing_value = NaN ;
time:_CoordinateAxisType = "Time" ;
double time_run(time) ;
time_run:long_name = "run times for coordinate = time" ;
time_run:standard_name = "forecast_reference_time" ;
time_run:calendar = "proleptic_gregorian" ;
time_run:units = "hours since 2011-06-21 00:00:00.000 UTC" ;
time_run:missing_value = NaN ;
time_run:_CoordinateAxisType = "RunTime" ;
double time_offset(time) ;
time_offset:long_name = "offset hour from start of run for coordinate = time" ;
time_offset:standard_name = "forecast_period" ;
time_offset:calendar = "proleptic_gregorian" ;
time_offset:units = "hours since 2011-06-21T00:00:00Z" ;
time_offset:missing_value = NaN ;
float Thgt(time, z, lat, lon) ;
Thgt:units = "meters" ;
Thgt:long_name = "significant wave height" ;
Thgt:standard_name = "sea_surface_wave_significant_height" ;
Thgt:short_name = "Thgt" ;
Thgt:valid_range = 0.f, 60.f ;
Thgt:_FillValue = NaNf ;
Thgt:coordinates = "time_run time z lat lon " ;
float Tper(time, z, lat, lon) ;
Tper:units = "seconds" ;
Tper:long_name = "peak wave period" ;
Tper:standard_name = "sea_surface_wave_period_at_variance_spectral_density_maximum" ;
Tper:short_name = "Tper" ;
Tper:valid_range = 0.f, 60.f ;
Tper:_FillValue = NaNf ;
Tper:coordinates = "time_run time z lat lon " ;
float Tdir(time, z, lat, lon) ;
Tdir:units = "degrees" ;
Tdir:long_name = "peak wave direction" ;
Tdir:standard_name = "sea_surface_wave_from_direction" ;
Tdir:short_name = "Tdir" ;
Tdir:valid_range = 0.f, 360.f ;
Tdir:_FillValue = NaNf ;
Tdir:coordinates = "time_run time z lat lon " ;
float shgt(time, z, lat, lon) ;
shgt:units = "meters" ;
shgt:long_name = "swell significant wave height" ;
shgt:standard_name = "sea_surface_swell_wave_significant_height" ;
shgt:short_name = "shgt" ;
shgt:valid_range = 0.f, 60.f ;
shgt:_FillValue = NaNf ;
shgt:coordinates = "time_run time z lat lon " ;
float sper(time, z, lat, lon) ;
sper:units = "seconds" ;
sper:long_name = "swell peak wave period" ;
sper:standard_name = "sea_surface_swell_wave_period" ;
sper:short_name = "sper" ;
sper:valid_range = 0.f, 60.f ;
sper:_FillValue = NaNf ;
sper:coordinates = "time_run time z lat lon " ;
float sdir(time, z, lat, lon) ;
sdir:units = "degrees" ;
sdir:long_name = "swell peak wave direction" ;
sdir:standard_name = "sea_surface_swell_wave_from_direction" ;
sdir:short_name = "sdir" ;
sdir:valid_range = 0.f, 360.f ;
sdir:_FillValue = NaNf ;
sdir:coordinates = "time_run time z lat lon " ;
float whgt(time, z, lat, lon) ;
whgt:units = "meters" ;
whgt:long_name = "wind significant wave height" ;
whgt:standard_name = "sea_surface_wind_wave_significant_height" ;
whgt:short_name = "whgt" ;
whgt:valid_range = 0.f, 60.f ;
whgt:_FillValue = NaNf ;
whgt:coordinates = "time_run time z lat lon " ;
float wper(time, z, lat, lon) ;
wper:units = "seconds" ;
wper:long_name = "wind peak wave period" ;
wper:standard_name = "sea_surface_wind_wave_period" ;
wper:short_name = "wper" ;
wper:valid_range = 0.f, 60.f ;
wper:_FillValue = NaNf ;
wper:coordinates = "time_run time z lat lon " ;
float wdir(time, z, lat, lon) ;
wdir:units = "degrees" ;
wdir:long_name = "wind peak wave direction" ;
wdir:standard_name = "sea_surface_wind_wave_from_direction" ;
wdir:short_name = "wdir" ;
wdir:valid_range = 0.f, 360.f ;
wdir:_FillValue = NaNf ;
wdir:coordinates = "time_run time z lat lon " ;
// global attributes:
:title = "WaveWatch III (WW3) Hawaii Regional Wave Model" ;
:_CoordSysBuilder = "ucar.nc2.dataset.conv.CF1Convention" ;
:Conventions = "CF-1.6, ACDD-1.3" ;
:cdm_data_type = "Grid" ;
:featureType = "GRID" ;
:location = "Proto fmrc:WaveWatch_III_Hawaii_Regional_Wave_Model" ;
:id = "ww3_hawaii" ;
:naming_authority = "org.pacioos" ;
:Metadata_Link = "http://pacioos.org/metadata/ww3_hawaii.html" ;
:ISO_Topic_Categories = "oceans" ;
:summary = "Through a collaborative effort with NOAA/NCEP and NWS Honolulu, the University of Hawaii has implemented a global-scale WaveWatch III (WW3) model, which in turn provides boundary conditions for this Hawaii regional WW3: a 7-day model with a 5-day hourly forecast at approximately 5-km or 0.05-deg resolution. The primary purpose of this regional model is to capture island effects such as island shadowing, refraction, and accurate modeling of local wind waves. Hawaii WW3 is forced with winds from the University of Hawaii Meteorology Department\'s operational mesoscale model, which has a more suitable spatial resolution than the global scale wind field. The Hawaii regional WW3 also provides boundary conditions for nearshore island-scale models via Simulating WAves Nearshore (SWAN). While considerable effort has been made to implement all model components in a thorough, correct, and accurate manner, numerous sources of error are possible. As such, please use these data with the caution appropriate for any ocean related activity." ;
:keywords = "Earth Science Services > Models > Ocean General Circulation Models (OGCM)/Regional Ocean Models, Earth Science Services > Models > Weather Research/Forecast Models, Earth Science > Oceans > Ocean Waves > Significant Wave Height, Earth Science > Oceans > Ocean Waves > Wave Period, Earth Science > Oceans > Ocean Waves > Wave Speed/Direction" ;
:keywords_vocabulary = "GCMD Science Keywords" ;
:platform = "Models/Analyses > > Operational Models" ;
:platform_vocabulary = "GCMD Platform Keywords" ;
:instrument = "Not Applicable > Not Applicable" ;
:instrument_vocabulary = "GCMD Instrument Keywords" ;
:locations = "Continent > North America > United States Of America > Hawaii, Ocean > Pacific Ocean > Central Pacific Ocean > Hawaiian Islands" ;
:locations_vocabulary = "GCMD Location Keywords" ;
:standard_name_vocabulary = "CF Standard Name Table v39" ;
:comment = "Model runs produced by Dr. Kwok Fai Cheung (cheung@hawaii.edu)." ;
:geospatial_lat_min = 18. ;
:geospatial_lat_max = 23. ;
:geospatial_lon_min = 199. ;
:geospatial_lon_max = 206. ;
:geospatial_vertical_min = 0. ;
:geospatial_vertical_max = 0. ;
:geospatial_bounds = "POLYGON ((18 -161.0, 23 -161.0, 23 -154.0, 18 -154.0, 18 -161.0))" ;
:geospatial_bounds_crs = "EPSG:4326" ;
:time_coverage_start = "2011-06-21T21:00:00Z" ;
:geospatial_lat_units = "degrees_north" ;
:geospatial_lat_resolution = 0.05 ;
:geospatial_lon_units = "degrees_east" ;
:geospatial_lon_resolution = 0.05 ;
:geospatial_vertical_units = "meters" ;
:geospatial_vertical_positive = "up" ;
:geospatial_vertical_resolution = 0. ;
:time_coverage_resolution = "PT1H" ;
:creator_email = "cheung@hawaii.edu" ;
:creator_name = "Kwok Fai Cheung" ;
:creator_type = "person" ;
:creator_url = "http://www.ore.hawaii.edu/OE/cheung_research.htm" ;
:creator_institution = "University of Hawaii" ;
:date_created = "2011-06-22" ;
:date_issued = "2011-06-22" ;
:date_modified = "2014-06-23" ;
:date_metadata_modified = "2017-01-30" ;
:institution = "University of Hawaii" ;
:project = "Pacific Islands Ocean Observing System (PacIOOS)" ;
:program = "Pacific Islands Ocean Observing System (PacIOOS)" ;
:contributor_name = "Jim Potemra" ;
:contributor_role = "distributor" ;
:publisher_email = "info@pacioos.org" ;
:publisher_name = "Pacific Islands Ocean Observing System (PacIOOS)" ;
:publisher_url = "http://pacioos.org" ;
:publisher_institution = "University of Hawaii" ;
:publisher_type = "group" ;
:license = "The data may be used and redistributed for free but is not intended for legal use, since it may contain inaccuracies. Neither the data Contributor, University of Hawaii, PacIOOS, NOAA, State of Hawaii nor the United States Government, nor any of their employees or contractors, makes any warranty, express or implied, including warranties of merchantability and fitness for a particular purpose, or assumes any legal liability for the accuracy, completeness, or usefulness, of this information." ;
:acknowledgement = "The Pacific Islands Ocean Observing System (PacIOOS) is funded through the National Oceanic and Atmospheric Administration (NOAA) as a Regional Association within the U.S. Integrated Ocean Observing System (IOOS). PacIOOS is coordinated by the University of Hawaii School of Ocean and Earth Science and Technology (SOEST)." ;
:source = "WaveWatch III (WW3) numerical wave model" ;
:references = "http://pacioos.org/waves/model-hawaii/, http://polar.ncep.noaa.gov/waves/wavewatch/" ;
:history = "FMRC Best Dataset" ;
最佳答案
默认情况下,xarray 将具有“seconds”形式的 units
属性的变量转换为 np.timedelta64
以及具有“seconds since ... "到 np.datetime64
。
这对于某些应用程序来说很方便。为了使这个更具体,让我在您的 netCDF 文件中突出显示 ncdump -h
中的一个部分:
netcdf WaveWatch_III_Hawaii_Regional_Wave_Model_best {
variables:
double time(time) ;
time:long_name = "Forecast time for ForecastModelRunCollection" ;
time:standard_name = "time" ;
time:calendar = "proleptic_gregorian" ;
time:units = "hours since 2011-06-21 00:00:00.000 UTC" ;
time:missing_value = NaN ;
time:_CoordinateAxisType = "Time" ;
double time_run(time) ;
time_run:long_name = "run times for coordinate = time" ;
time_run:standard_name = "forecast_reference_time" ;
time_run:calendar = "proleptic_gregorian" ;
time_run:units = "hours since 2011-06-21 00:00:00.000 UTC" ;
time_run:missing_value = NaN ;
time_run:_CoordinateAxisType = "RunTime" ;
double time_offset(time) ;
time_offset:long_name = "offset hour from start of run for coordinate = time" ;
time_offset:standard_name = "forecast_period" ;
time_offset:calendar = "proleptic_gregorian" ;
time_offset:units = "hours since 2011-06-21T00:00:00Z" ;
time_offset:missing_value = NaN ;
float Tper(time, z, lat, lon) ;
Tper:units = "seconds" ;
Tper:long_name = "peak wave period" ;
Tper:standard_name = "sea_surface_wave_period_at_variance_spectral_density_maximum" ;
Tper:short_name = "Tper" ;
Tper:valid_range = 0.f, 60.f ;
Tper:_FillValue = NaNf ;
Tper:coordinates = "time_run time z lat lon " ;
我对CF的理解standard names forecast_period
应该等于 time
和 forecast_reference_time
之间的差值,即 forecast_period = time - forecast_reference_time
。如果您使用“小时”形式的单位指定您的 time_offset
变量,那么它将被解码为 timedelta64
,以及 datetime64
for time
和 time_run
,所以 xarray 的算法实际上会满足这个恒等式。如果您只想包含其中两个变量并想即时计算第三个变量,您可能会发现这很有用。
另一方面,您可能不想将 Tper
变量转换为 timedelta64
。从技术上讲,它也是一个时间段,但它不是一个与 time
比较有意义的变量。
不幸的是,xarray 目前无法通过查看变量元数据来区分这两种情况,因此它将所有内容都转换为 timedelta64
(尽管我很乐意在 GitHub 上讨论您可能有的想法) .目前,最好的解决方法是在使用 xarray 解码之前从这些变量中删除 units 属性,例如,
raw = xr.open_dataset(url, decode_cf=False)
del raw.Tper.attrs['units']
ds = xr.decode_cf(raw)
关于python - xarray 波周期以秒为单位作为 timedelta64 摄取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46552078/
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭10 年前。 Improve th
我正在尝试将 JSON 发送到我的服务器并作为结果检索 JSON。例如发送用户名和密码并取回 token 和其他内容。 这就是我正在为发送的 HTTP 请求所做的。我现在如何检索同一请求中的内容?
我有以下 xts 矩阵: > options(digits.secs = 6) > set.seed(1234) > xts(1:10, as.POSIXlt(1366039619, tz="EST"
我目前正在开发一个应用程序,当用户到达某个位置时,它会提醒用户。我希望这个应用程序也在后台运行并搜索解决方案。 在 AppStore 中,我发现了一款名为“Sleep Cycle”的应用程序,它可
我想创建一个基于 farbtastic color picker 的颜色选择器。我想要实现的是添加我想要链接到色轮的 RGB slider 。这是我到目前为止所拥有的。 app.controller(
RFC 5545 允许 RDATE 属性具有 PERIOD 数据类型。该数据类型的语义是什么?据我所知,这是未指定的。它会改变事件的持续时间吗?如果时区更改且没有持续时间怎么办? 最佳答案 尽管我
在 CodinGame学习平台,C# 教程中用作示例的问题之一是: The aim of this exercise is to check the presence of a number in a
我听说网上有一本英特尔书,它描述了特定汇编指令所需的 CPU 周期,但我找不到(经过努力)。谁能告诉我如何找到CPU周期? 这是一个例子,在下面的代码中,mov/lock 是 1 个 CPU 周期,x
据我所知,Java GC有次要GC(低成本)和主要GC周期(高成本)。如果对象在本地范围内,则会在 Minor GC 中清理它。如果对象的引用存储在代码中的其他位置,则它会在主 GC 中被清除。 例如
到目前为止,我有一个很好的自旋锁,可以用作 intendend: std::atomic_flag barrier = ATOMIC_FLAG_INIT; inline void lo
晚上好,我将 cycle2 与 prev 和 next 函数一起使用,但我无法将 prev 和 next 函数置于图像下方的中心。我环顾四周,我知道这会很愚蠢,但我就是看不到它。非常令人沮丧。谢谢加里
出于教育目的,我想知道在优化(在不同级别)和编译之后执行函数需要多少 CPU 周期。有没有办法分析代码或可执行文件以获得可重现的答案?我在 64 位 Windows 7 Pro 上使用 Eclipse
我想彻底测量和调整我的 C/C++ 代码,以便在 x86_64 系统上更好地使用缓存。我知道如何使用计数器(我的 Windows 机器上的 QueryPerformanceCounter)来测量时间,
我尝试将一些数据分组到每四周一次的存储桶中,并使用 pd.Grouper(key='created_at', freq='4W')。我希望这些组是这样的,如果我有从 2019-08-26 到 2019
我正在做一个关于随机数的大型学校项目,但我找不到 Math.random() 的句点。我安装了 7.0.800.15 版本,并且正在使用 Windows 10 计算机。我试过用一个简单的程序来确定周期
我正在努力解决我们生产环境中垃圾收集利用率高的问题,我想知道设置一个大的堆大小来保证老年代永远不会被填满是否会阻止触发主要的 GC 周期。 为了实现这一点,我想有一个特定的阈值标记会触发主要的 GC
我想测量在 Python 3 中执行加法运算所需的时钟周期数。 我写了一个程序来计算加法运算的平均值: from timeit import timeit def test(n): for i
我正在寻找一种方法来测量线程上的函数调用所花费的 cpu 周期。 示例伪代码: void HostFunction() { var startTick = CurrentThread.Cur
就 CPU 周期而言,malloc() 的成本是多少?(Vista/OS,最新版本的 gcc,最高优化级别,...) 基本上,我正在实现一个复杂的 DAG 结构(类似于链表)由一些 16B(不太常见)
C/C++ 中的类型转换会导致额外的 CPU 周期吗? 我的理解是,至少在某些情况下应该消耗额外的 CPU 周期。就像从浮点类型转换为整数一样,CPU 需要将浮点结构转换为整数。 float a=2.
我是一名优秀的程序员,十分优秀!