netcdf

Extend dimensions in netCDF file using R

安稳与你 提交于 2019-12-05 16:02:27
问题 I would like to write a netCDF file using R with 'unlimited' dimensions that I can later extend. This is what I have tried: Create a netcdf file library(ncdf4) ## define lat, lon time dimensions lat <- ncdim_def("latitude", "degrees_east", vals = 44.0, unlim = TRUE) lon <- ncdim_def("longitude", "degrees_north", vals = -88.5, unlim = TRUE) time <- ncdim_def("time", "days since 0000-01-01", 1:1000) ## define data with these dimensions x <- ncvar_def("myvar", units = "m2", dim = list(lat, lon,

time and geographical subset of netcdf raster stack or raster brick using R

一个人想着一个人 提交于 2019-12-05 14:13:20
For the following netcdf file with daily global sea surface temperatures for 2016, I'm trying to (i) subset temporally, (ii) subset geographically, (iii) then take long-term means for each pixel and create a basic plot. Link to file: here library(raster) library(ncdf4) open the netcdf after setting my working directory nc_data <- nc_open('sst.day.mean.2016.v2.nc') change the time variable so it's easy to interpret time <- ncdf4::ncvar_get(nc_data, varid="time") head(time) change to dates that I can interpret time_d <- as.Date(time, format="%j", origin=as.Date("1800-01-01")) Now I'd like to

How to convert a rotated NetCDF back to a normal lat/lon grid?

故事扮演 提交于 2019-12-05 09:43:10
I have a NetCDF file with rotated coordinates. I need to convert it to normal lat/lon coordinates (-180 to 180 for lon and -90 to 90 for lat). library(ncdf4) nc_open('dat.nf') For the dimensions, it shows: [1] " 5 variables (excluding dimension variables):" [1] " double time_bnds[bnds,time] " [1] " double lon[rlon,rlat] " [1] " long_name: longitude" [1] " units: degrees_east" [1] " double lat[rlon,rlat] " [1] " long_name: latitude" [1] " units: degrees_north" [1] " char rotated_pole[] " [1] " grid_mapping_name: rotated_latitude_longitude" [1] " grid_north_pole_longitude: 83" [1] " grid_north

java netcdf 4 tutorial

我与影子孤独终老i 提交于 2019-12-05 09:41:40
I am using the latest netcdf jar library from unidata website here: http://www.unidata.ucar.edu/downloads/netcdf/index.jsp I am looking for a java netcdf 4 tutorial/example but I can't seem to find one on their website or anywhere else for that matter. Version 4 is significantly different than the previous versions in that the write function (to write data to a variable) is no longer used and is replaced by writeCDL...I think. Has anyone used the latest version of netcdf with java? I'd really appreciate if someone could point me in the right direction. Thanks for your help! -Dom P.S. Here is

Plot NetCDF variable-grid data file using ggplot2: “Vector is too large” error

泄露秘密 提交于 2019-12-05 08:03:01
问题 I need to plot some data from this NetCDF file (1.1MB). The file contains a 413x229 grid (94577 points). Every point has a precipitation value which I need to print in the correct LAT-LON. The grid is not necessarily constant, so that we have two additional 413x229 variables (xlat and xlon) containing the lat-lon values for each grid point. Thanks to the hints from these questions... How to plot contours on a map with ggplot2 when data is on an irregular grid? R - Plotting netcdf climate data

Python: How to use MFdataset in netCDF4

人盡茶涼 提交于 2019-12-04 21:16:05
I am trying to read multiple NetCDF files and my code returns the error: ValueError: MFNetCDF4 only works with NETCDF3_* and NETCDF4_CLASSIC formatted files, not NETCDF4. I looked up the documentation and MFdataset is not supported by NetCDF4, so I'm confused where to go from here. I think the error is pretty clear, but there are ways to avoid it. 1/ You could convert the NetCDF files from NetCDF4 to the classic format using e.g. nccopy : nccopy -k classic nc4_file.nc ncclassic_file.nc 2/ xarray has a similar method (called open_mfdataset ) which is able to handle NetCDF4 files. A quick test:

NCO cropping a netcdf file using dimension values rather than indices

a 夏天 提交于 2019-12-04 18:08:28
CDO can crop a netcdf file in terms of latitude and longitude as long as they are defined in a standard way, and I know that NCO can cut out a subset of a netcdf file along any dimension if you know the range of indices that you want, as stated in the answers to this related question: Is there a way to crop a NETCDF file? However, I was wondering if the ncks hyperslabber can work directly on the values of the dimension, rather than the index values? Yes, using a decimal indicates the range of actual values (eg, latitudes) to extract over, while using integers indicates the range of indices

Geoserver - GetFeatureInfo of raster/wms layer multiple points/location or bounding box

我是研究僧i 提交于 2019-12-04 17:54:22
I am using Geoserver 2.8.1 version. I have netcdf and grib files, and I am uploading those to Geoserver through Geoserver extensions . After that, I use those data to show layer feature info in the map. (According to zoom scale and image size)I put arrows in the map to reference wind and wave directions. I calculate, to which angle the arrow will be positioned, by getting netcdf info like this; localhost:8080/geoserver/wms?Service=WMS&version=1.3&bbox=23.75,32.75,24.25,33.25&layers=it.geosolutions:u10&query_layers=it.geosolutions:u10&FEATURE_COUNT=10&REQUEST=GetFeatureInfo&INFO_FORMAT

NetCDF to Raster Brick “Unable to find inherited method for function 'brick' for 'ncdf4'”

两盒软妹~` 提交于 2019-12-04 17:12:48
Really simple problem with the raster package, also using ncdf4 to load in an ECMWF Era-Interim Netcdf file. Simply doing this: a <- nc_open("SSTs.nc") B <- brick(a, varname="sst") Returns this: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘brick’ for signature ‘"ncdf4"’ The file is just SST data over the whole globe, for 1 month (Jan2016). When I convert it into an array (i.e. extract dimensions/variable, and convert time to UTC, shove it into an array) I don't get the same error, but the raster package says it supports .nc files straight in (so

Importing variables from Netcdf into Python

隐身守侯 提交于 2019-12-04 15:45:06
I am very new to Python, and I have managed to read in some variables from NetCDF in to Python and plot them, but the size of the variables isn't correct. My dataset is 144 x 90 (lon x lat) but when I call in the variables, it seems to miss a large section of data. Do I need to specify the size of the dataset I'm reading in? Is that what I'm doing wrong here? Here is the code I am using: import netCDF4 from netCDF4 import Dataset from pylab import * ncfile = Dataset('DEC3499.aijE03Ccek11p5A.nc','r') temp = ncfile.variables['tsurf'] prec = ncfile.variables['prec'] subplot(2,1,1) pcolor(temp)