netcdf

Netcdf4.4的安装过程(附netcdf4.1.3安装过程)

匿名 (未验证) 提交于 2019-12-03 00:38:01
写这个文章,主要有两个目的:一个是自己备忘;另一个是分享 . 方便自己也帮助他人 . NetCDF全称为network Common Data Format,中文译法为“网络通用数据格式”,对程序员来说,它和zip、jpeg、bmp文件格式类似,都是一种文件格式的标准。netcdf文件开始的目的是用于存储气象科学中的数据,现在已经成为许多数据采集软件的生成文件的格式。 注: netcdf4.2 以上的版本 c 库和 fortran 库分开,要先安装 netcdf-c, 然后再安装 netcdf-fortran 平台: centos6.9 安装步骤: ( 1 )编译环境的设置: 终端中输入如下语句:本人使用 intel 的编译器来编译,其他编译器(如 gfortran )对应修改。 exportCC=icc exportCXX=icpc exportFC=ifort exportF90=ifort exportF77=ifort 安装之前的说明: 1. 由于安装 netcdf4 需要 zlib 和 hdf5, 我们将把这些安装在同一个目录下,方便后面的环境变量配置 . 2. 安装使用的是 root 用户 , 如果读者用户没有 root 权限,可以使用 sudo 来提升权限。 ( 2 )安装 zlib (应该是用于数据压缩, szip 安装同 zlib ) 1. 下载地址: ftp:/

读取HDF或者NetCDF格式的栅格数据

匿名 (未验证) 提交于 2019-12-03 00:21:02
作者:阿振 邮箱:tanzhenyugis@163.com 博客: https://blog.csdn.net/theonegis/article/details/80089375 修改时间:2018-05-25 声明:本文为博主原创文章,转载请注明原文出处 HDF HDF(Hierarchical Data Format)由NCSA(National Center for Supercomputing Applications)设计提出,官方对其定义是:HDF5 is a unique technology suite that makes possible the management of extremely large and complex data collections. HDF supports n-dimensional datasets and each element in the dataset may itself be a complex object. HDF是对HDF数据模型,数据格式以及HDF库API等一系列技术的总称. HDF的最新版本是HDF5. HDF数据模型基于组(groups)和数据集(datasets)概念:如果把HDF数据比作磁盘,那么组相当于文件夹,数据集相当于文件。组和数据集都有用户自定义的属性(attributes).

ROMS海洋模式笔记

匿名 (未验证) 提交于 2019-12-02 23:57:01
按网站说明文档上用Subversion工具下载源代码安装 超算服务器提供已编译好的intel编译器、netcdf、impi和openmpi等库 module load 加载库时会自动加载它的依赖库和编译器,这样可以配套加载 比如加载netcdf会自动加载相应的编译器 upwelling application 编译 在 build_roms.bash中 export ROMS_APPLICATION=UPWELLING export USE_NETCDF4=on # compile with NetCDF-4 library 加载的模块库如下: (1) intel/15.0.6 2) hdf5/intel15/1.8.13 3) netcdf/intel15/4.3.3.1 串行编译成功 并行编译选择MPI软件测试结果 IMPI和MPICH都会报错,openmpi通过 Currently Loaded Modulefiles: (1) hdf5/intel15/1.8.13 2) netcdf/intel15/4.3.3.1 3) intel/18.0.2 4) mpi/openmpi/3.1.2-icc18 export USE_MPI=on # distributed-memory parallelism export USE_MPIF90=on # compile with

R: Write RasterStack and preserve layer names

谁都会走 提交于 2019-12-02 22:55:45
I have a raster stack, stk , consisting of three raster images in R. Here is a simple example # set up a raster stack with three layers > library(raster) > r <- raster(nrows=10,ncols=10) > r[] <- rnorm(100) > stk <- stack(r,r,r) # layer names are set by default > names(stk) [1] "layer.1" "layer.2" "layer.3" I assign names to the raster layers: # set layer names to "one", "two" and "three" > names(stk) <- c('one','two','three') > names(stk) [1] "one" "two" "three" When I write the RasterStack to a GeoTiff (multilayered) using: writeRaster(stk,"myStack.tif", format="GTiff") The layers are

Convert NetCDF (.nc) to GEOTIFF

戏子无情 提交于 2019-12-02 01:15:25
I have .nc file sizing around 300MB with a couple of datasets ( TEMP , DEWPOINT ) forecast data. I need to convert ( TEMP ) dataset to multiple GEOTIFF (one .tif for each time slice). Here is how the .nc file looks like. Looked into this answer but it seems to be for the whole dataset. I tried GDAL but not sure how to make it work for each time slice. Any thoughts? netcdf4 -python? gdal has a gdal_translate option that will allow you to do this to translate the file from .nc to .tiff . See below: gdal_translate -of GTiff file.nc test.tiff and using the -b option will allow you to specify which

How to change a Lambert Conic Conformal raster projection to latlon degree R

北战南征 提交于 2019-12-01 22:39:47
I have a raster, obtained from a netcdf which is in (Lambert Conic Conformal projection): library(meteoForecast) wrf_temporary <- getRaster("temp", day = Sys.Date(), frames = 'complete', resolution = 36, service = "meteogalicia") wrf_temporary extent : -18, 4230, -18, 3726 (xmin, xmax, ymin, ymax) coord. ref. : +proj=lcc +lat_1=43 +lat_2=43 +lat_0=34.82300186157227 +lon_0=-14.10000038146973 +x_0=536402.34 +y_0=-18558.61 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=km +no_defs Now I want to transform that wrf_temporary raster to "+proj=longlat +datum=WGS84" (lat long degree). What to do? I want

Python : Replacing Values in netcdf file using netCDF4

爱⌒轻易说出口 提交于 2019-12-01 19:38:09
I have a netcdf file with several values < 0. I would like to replace all of them with a single value (say -1). How do I do that using netCDF4? I am reading in the file like this: import netCDF4 dset = netCDF4.Dataset('test.nc') dset[dset.variables['var'] < 0] = -1 If you want to keep the data in the netCDF variable object, this should work: import netCDF4 dset = netCDF4.Dataset('test.nc') dset['var'][:][dset['var'][:] < 0] = -1 dset.close() # if you want to write the variable back to disk If you don't want to write back to disk, go ahead and just get the numpy array and slice/assign to it:

How can I specify dimension order when using ncdf4::ncvar_get?

↘锁芯ラ 提交于 2019-12-01 18:34:29
Following a previous question ( Faster reading of time series from netCDF? ) I have re-permuted my netCDF files to provide fast time-series reads ( scripts on github to be cleaned up eventually ... ). In short, to make reads faster, I have rearranged the dimensions from lat, lon, time to time, lat, lon . Now, my existing scripts break because they assume that the dimensions will always be lat, lon, time , following the ncdf4 documentation of ncvar_get , for the 'start' argument: Order is X-Y-Z-T (i.e., the time dimension is last) However, this is not the case. Furthermore, there is a related

copy netcdf file using python

懵懂的女人 提交于 2019-12-01 06:51:48
I would like to make a copy of netcdf file using Python. There are very nice examples of how to read or write netcdf-file, but perhaps there is also a good way how to make the input and then output of the variables to another file. A good-simple method would be nice, in order to get the dimensions and dimension variables to the output file with the lowest cost. Griffith Young I found the answer to this question at python netcdf: making a copy of all variables and attributes but one , but I needed to change it to work with my version of python/netCDF4 (Python 2.7.6/1.0.4). If you needed to add

How can I install netcdf4-python to ubuntu14.04?

人盡茶涼 提交于 2019-12-01 04:39:54
问题 I would like to install netcdf4-python to my Ubuntu14.04. The libhdf5-dev_1.8.11_5ubuntu7_amd64.deb and libnetcdf-4.1.3-7ubuntu2_amd64.deb are installed. I downloaded netcdf4-1.1.8.tar.gz from https://pypi.python.org/pypi/netCDF4#downloads I tried configure it by ./configure --enable-netcdf-4 –with-hdf5=/usr/include/ --enable-share –prefix=/usr but I got the following message: bash: ./configure: No such file or directory I do not know how I can install netcdf4-python. I would appreciated if