簡體   English   中英

Python netcdf grid_longitude

[英]Python netcdf grid_longitude

通常,當我處理文件時,坐標在 lon 和 lat 中,但在這種情況下,它們在“grid_longitude”中

import xarray as xr
dataset = xr.open_dataset(r'C:\Users\eg\Desktop\nec\sfcan20120101a20121231_rot_mask.nc')
dataset

<xarray.Dataset>
Dimensions:        (height: 1, rlat: 240, rlon: 280, time: 366)
Coordinates:
* rlon           (rlon) float64 -5.0 -4.95 -4.9 -4.85 ... 8.8 8.85 8.9 8.95
* rlat           (rlat) float64 -6.45 -6.4 -6.35 -6.3 ... 5.35 5.4 5.45 5.5
* height         (height) float64 0.0
* time           (time) datetime64[ns] 2012-01-01T06:00:00 ... 2012-12- 31T06:00:00
Data variables:
rotated_pole   |S1 ...
precipitation  (time, height, rlat, rlon) float32 ...
lon            (rlat, rlon) float32 ...
lat            (rlat, rlon) float32 ...
Attributes:
title:        AEMET High-resolution (0.05 deg) daily gridded precipitatio...
institution:  Agencia Estatal de Meteorologia (AEMET, www.aemet.es)
references:   Peral, C., Navascu�s, B., Ramos, P. Available at: http://ww...
history:      Creation year 2017
Conventions:  CF-1.7
version:      1.0

有人知道如何把它轉到東度和北度嗎?,謝謝

 <xarray.DataArray 'rlon' (rlon: 280)>
 array([-5.  , -4.95, -4.9 , ...,  8.85,  8.9 ,  8.95])
 Coordinates:
  * rlon     (rlon) float64 -5.0 -4.95 -4.9 -4.85 -4.8 ... 8.8 8.85 8.9 8.95
 Attributes:
long_name:      longitude in rotated pole grid
units:          degrees
standard_name:  grid_longitude
axis:           X

<xarray.DataArray 'lon' (rlat: 240, rlon: 280)>
 array([[-11.988, -11.928, -11.868, ...,   4.566,   4.625,   4.684],
   [-11.992, -11.932, -11.872, ...,   4.573,   4.633,   4.692],
   [-11.996, -11.936, -11.876, ...,   4.581,   4.64 ,   4.699],
   ...,
   [-13.136, -13.065, -12.994, ...,   6.57 ,   6.64 ,   6.71 ],
   [-13.142, -13.071, -13.   , ...,   6.58 ,   6.65 ,   6.72 ],
   [-13.148, -13.077, -13.006, ...,   6.59 ,   6.661,   6.731]],
  dtype=float32)
  Coordinates:
  * rlon     (rlon) float64 -5.0 -4.95 -4.9 -4.85 -4.8 ... 8.8 8.85 8.9 8.95
  * rlat     (rlat) float64 -6.45 -6.4 -6.35 -6.3 -6.25 ... 5.35 5.4 5.45 5.5
 Attributes:
long_name:  longitude
units:      degrees_east

你可以看到它們完全不同

數據將來自一個數值模型,其中模型坐標系的極點與地球的真實極點不同。 這通常在運行有限區域模型時完成,以使極點盡可能遠離正在建模的區域。 這允許模型的分辨率在模型域上大致均勻,因為坐標系近似為笛卡爾坐標系,並避免子午線靠近極點收斂的問題。

為了允許您正確定位文件中的其他字段, CF 約定要求模型網格中每個點的真實位置與數據數組一起存儲在文件中,通過包含真正的經度和緯度,在這個文件中被稱為lonlat

要完全確定這就是lonlat變量包含的內容,原則上您應該查看它們的屬性,尤其是任何standard_namelong_name變量屬性,盡管考慮到它們的名稱以及使用旋轉桿的事實,它是在這種情況下很明顯,這就是它們包含的內容。

有關更多信息,請參閱http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#grid-mappings-and-projections (此鏈接適用於 CF 約定的 1.7 版,因為那是數據文件中的內容。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM