2,362 questions
-1
votes
0
answers
29
views
How do I open NetCDF(.nc) file from customized WRF model via C++/Python?
I am a student majoring Computer Science.
Recently, I am struggling to open and extract specific data for my research from large amount of NetCDF files.
But there seems to be some problem processing ...
0
votes
1
answer
50
views
Error when using xarray.apply_ufunc on a chunked xarray DataArray
Hello I am trying to sort the data inside some netCDF4 (.nc) files into bins as efficiently as possible. I am currently trying this with xarray and NumPy's digitize function. Since I want to process a ...
0
votes
1
answer
40
views
Extract precipitation values from netcfd
I’m stuck on a question about extracting a variable from a NetCDF file. Here is the structure of my input netcdf file:
comephore_all
Out[37]:
<xarray.Dataset>
Dimensions: (x: 85, y: 99, time: ...
1
vote
2
answers
84
views
Extracting time from an unconventionally-named netcdf using terra
I have a netcdf file (ERA5 climate data) that I'm converting to a SpatRaster using terra. I would like to access the time data for each layer; however, the date element of the original file is named ...
0
votes
0
answers
22
views
Using getvar to obtain MSLP from a wrfout file gives an error
Just a quick question. I'm trying to extract 850 hPa U and V winds along with MSLP from my wrfout file. Here's my current code:
import numpy as np
import pandas as pd
import xarray as xr
from netCDF4 ...
1
vote
1
answer
43
views
How to create a DataFrame from GC-MS data with retention time, mass values, and intensities in Python with correct alignment?
I am processing gas chromatography - mass spectroscopy (GC-MS) data stored in a NetCDF file in Python, and I’m having trouble aligning the data correctly to create a structured DataFrame. My goal is ...
0
votes
1
answer
57
views
How to split a raster stack by seasons in R
Issue
I have downloaded multiple Lm3 4 km netcdf files (n = 4640) for sea surface temperature from the Ocean Colour Project, NASA from 2012 to 2024.
I have put all my files into a raster stack:
class ...
0
votes
1
answer
75
views
How to extract point data for sea surface temperature for specific dates over multiple years from multiple netcdf files using terra::extract() in R
I have downloaded multiple Lm3 4 km netcdf files (n = 4640) for sea surface temperature from the Ocean Colour Project, NASA.
class : SpatRaster
dimensions : 766, 709, 1 (nrow, ncol, nlyr)
...
1
vote
1
answer
43
views
Geoserver API - "the specified coverage is not available"
I am using GeoServer 2.26.0 (docker.osgeo.org/geoserver:2.26.0), and the only extension I have installed is NetCDF; otherwise, it is a vanilla install.
I have created a NetCDF store and successfully ...
0
votes
0
answers
41
views
Brick netcdf of 5 dimensions in R
I used to use the next function with a netcdf of 4 dimensions (longitude, latitude, time, and member) and using brick and could reduce the netcdf to 3 dimensions (long, lat, time), however the product ...
0
votes
1
answer
63
views
How to Extract Point Data from Multiple Subsetted Netcdf Files for Sea Surface Density using terra::rast() and terra::extract functions in R
Description of Data
I downloaded MULTIOBS_GLO_PHY_S_SURFACE_MYNRT_015_013 data for daily sea surface density from 2012 to 2024 from The Copernicus Website. A person can only download 2 years of data ...
0
votes
0
answers
26
views
Am I doing the t-test on wind vectors correctly?
I'm trying to create an wind anomaly plot and shade the regions that are statistically significant at the 95% level using the Student's t-test.
The anomaly plot is simple to do. The problem is that my ...
0
votes
2
answers
66
views
Concatenating netcdf and hdf5 files
I have two data files in two formats, one is netcdf, the other is hdf5. I wish to combine them and export the combined data as hdf5. My current solution includes converting each to a python dictionary ...
-1
votes
1
answer
170
views
Creating a SpatRaster with Multiple Binned AQUA-MODIS (NetCDF) Files with the Function terra::rast() in R
Issue
I downloaded AQUA-MODIS netcdf files (total = 3422) for chlorophyll-a from the Earthdata website from 2012 to 2024 for The Northern Red Sea, Egypt.
I need to:
Stack all the 3422 AQUA MODIS ...
2
votes
1
answer
71
views
xarray and dask: efficiently processing a large netcdf file
I am trying to do a simple calculation on a very large netcdf file, and am struggling to speed it up -- probably because I program primarily in julia and R. I think xarray/dask are the best approach ...
0
votes
1
answer
75
views
How to get the right URL for thredds and load ncml data in R?
I'm trying to load some climate data from PAVICS with thredds in R.
library(ncdf4)
library(thredds)
url = "https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/catalog/datasets/simulations/...
-2
votes
1
answer
64
views
Which keyword to use for extracting data from netCDF file
The header of a netCDF file reads:
netcdf gpw_v4_population_density_rev11_2pt5_min {
dimensions:
longitude = 8640 ;
latitude = 4320 ;
raster = UNLIMITED ; // (20 currently)
...
1
vote
1
answer
129
views
Python netcdf EOF analysis
I am performing a EOF analysis for JJAS NDVI.
Here is the NDVI data (https://drive.google.com/drive/folders/1-QBkzTlAJRq8etuD15x_7l08woFTR86Y?usp=sharing) and codes.
from netCDF4 import Dataset
...
1
vote
1
answer
44
views
Python NetCDF Prime Meridian Line blank [duplicate]
I am trying to draw climatology map of GPCC precipitation.
But I found out there is a blank (data cut) in Prime Meridian Line.
How can I fix the problem? I can use CDO, NCO, Python.
I also share the ...
0
votes
0
answers
38
views
Nan values are generating while interpolating data over 800 hpa using wrf python but working in 300,500
i am working on netcdf file and interpolating data for geopotential height 850hpa , 700hpa, 500hpa and 3oohpa
height =getvar(ncfile, 'z', timeidx=i)
pressure=getvar(ncfile,'pressure',timeidx=i)...
1
vote
1
answer
60
views
Writing an ncdf4 file to disk after accessing it through OPeNDAP using R?
I am accessing a ncdf file from a thredds server and subsetting using openDAP, however while I can open and access the file connection, I cannot seem to copy the entire *.nc file to my local disk. Is ...
0
votes
1
answer
61
views
Reading netcdf in R with lon lat dimensions reported as single 1D vector
I need to work with these data in R: https://zenodo.org/records/1209296 in particular "irrigation water use v2.7z". I opened the netcdf inside R both with terra and raster library. I should ...
1
vote
1
answer
73
views
How to subtract two xarrays that have different coordinate systems and grids?
I'm new here and would like to thank anyone that takes the time to respond !
I am trying to compare two netcdf's from different sources. The first one (A) is on a longitude/latitude grid.
The second ...
0
votes
1
answer
53
views
How to interpolate 3d variable like RAINC from netcdf file using wrf-python
Currently ,I am working on netcdf file ,from which i need to extract data using wrf-python and plot in the graph,
while plotting , i got an issue ( i have attached the image, you can refer it).
Before ...
0
votes
0
answers
45
views
Trouble Reprojecting Rotated Latitude-Longitude Grid to EPSG:4326 in GDAL
I am facing difficulties with reprojecting a NetCDF file containing data on a rotated latitude-longitude grid. Despite several attempts, I have been unable to align the data correctly with geographic ...
0
votes
1
answer
82
views
netCDF file without crs/Clipping to the shape file with projected shape file
Issues Encountered:
The NetCDF file has rotated grid coordinates (rlon, rlat), which adds complexity to aligning it with the shapefile.
When I try to clip the NetCDF data with the shapefile, I receive ...
0
votes
1
answer
37
views
Not able to export data array to nc file
I am trying to export a nc file after regridding but i am facing ValueError while exporting the data. The code is as below and snippet of the error is also attached. The file i am working on is:
https:...
0
votes
0
answers
66
views
Interpolation of .nc file when regridding is returning 'nan' values
I'm trying to regrid the .nc file to upscale the resolution for a random forest model. I am using the xarray.interp for this purpose. For my .nc file only linear and slinear interpolation is working ...
0
votes
1
answer
132
views
Units of time variable in downloaded netCDF file are not compatible with the request code in ERA5 reanalysis data
I put my request to download the required data from the below Dataset of the ERA5 reanalysis
ERA5 hourly data on single levels from 1940 to present
In the downloaded .nc file, when I read it in the ...
0
votes
0
answers
57
views
Importing "Common Data Format" (CDF) into R
I have to import some special "common data format" (CDF) by the MMS Science Data Centre.
As I know cdf files can be imported into R using netcdf associated packages. However, I have ...
0
votes
0
answers
22
views
Xarray .where() unable to parse multiple n-dimensional arrays
I'm trying to use the xr.where() function to create a binary based on multiple arrays. The code I am using is the following:
binary = xr.where((snd_nc.SNOWDP >= 0.2) & (tas_nc.tas <= 0) &...
1
vote
0
answers
17
views
Creating annual sum precipitation from netcdf timeseries using cf-python
I have a netcdf file containing daily precipitation over many years. I want to calcul annual precipitation. To achieve that I am using cf-python. I run into the following error: 'UFuncTypeError: ...
1
vote
1
answer
124
views
Xarray failing to save NetCDF due to illegal characters
I have a DataFrame in python. Using "df.to_excel('temp/df.xlsx')" i have exported it, here is a screenshot of the resulting file in Excel:
This exists in python as a Pandas DataFrame.
I ...
0
votes
1
answer
55
views
Computing and Visualizing Linear Trends in Ocean Temperature Data
I have a dataset containing ocean temperature values for the time period 1950-2022, covering the entire globe. My goal is to calculate the linear trend for each surface grid box and visualize the ...
0
votes
0
answers
28
views
Subset from NetCDF4 dataset - How
I have a netCDF4 dataset in python with 3 variables (height, lat, long).
I want all the lat and long values when height is 1.
I understand that is something like generate a new dataset when height is ...
0
votes
1
answer
80
views
How to restructure this netCDF?
UPDATE: I uploaded the file to dropbox and can be downloaded via this link (I hope this works, I don't use dropbox often): https://www.dropbox.com/scl/fi/vd0s9g080m8h9fxh7rn9l/...
0
votes
0
answers
14
views
Processing netcdf file using python script on linux cluster - no output but no error
import os
import numpy as np
import xarray as xr
# Load environment variables (if needed)
os.system("source ~/.bashrc")
# Define the input directory and base output directory
input_dir = '/...
1
vote
1
answer
59
views
Save curvilinear grid to NetCDF file using R
I am working with ROMS ocean model outputs, which have curvilinear grids. I would like to be able to save a variable (subset) from those outputs to a NetCDF file in a way that it is recognised to have ...
1
vote
1
answer
69
views
Creating Mean Monthly Data
I have monthly data for each year spanning from 1950 to 2022, and each year contains 12 monthly timesteps.
How can I calculate and generate a single mean monthly data file that averages the values ...
0
votes
1
answer
117
views
How to preprocess dataset to assign coordinates before opening with xarray.open_mfdataset?
The xarray documentation for the open_mfdataset function states that you can use the preprocess argument to apply a function to each dataset before concatenation. The NetCDF datasets I have do not ...
0
votes
1
answer
69
views
Matching data structure between two netCDF files
I have two netCDF files:
WATCH data:
> watch_Tair:
2 variables (excluding dimension variables):
int timestp[tstep]
title: time steps
units: time steps (days)...
0
votes
2
answers
192
views
Coordinates of an NetCDF file comes flipped out
I have created a new variable called 'temperature' that represents the temperature gradient to detect oceanic thermal fronts. One issue I encounter when plotting this variable is that the terrestrial ...
0
votes
0
answers
96
views
Cant import xarray file
I am having a problem, where python cant seem to find to find t file that is in the same folder as the Jupiter notebook. I have tried copying the whole address, but it doesn't work.
I have recently ...
0
votes
0
answers
174
views
How to use gdal_translate in Python
I am trying to convert a netCDF file to a Cloud Optimized GeoTiff (COG) format. I have been able to do so successfully in the OSGeo4W Shell using the following command:
gdal_translate -of GTiff NETCDF:...
0
votes
0
answers
42
views
Cannot access groups in a NetCDF file from a YAML file
I have a YAML file in which I want to store the variables from a netCDF file and access the latter.
files:
- path: "file.nc"
variables:
radiance: radiance
groups:
...
0
votes
0
answers
67
views
Netcdf file exploration on the command line
Given a netcdf file with a variable with a dimension, can I use some command line tool to find the indices of the dimension where the variable satisfies some condition, eg equals a particular value or ...
0
votes
0
answers
61
views
Converting Shapefile to NetCDF - Error "Multipolygon has no len()"
I'm trying to convert a Shapefile that is simply the borders of a country into a NetCDF format for further use in a general circulation model.
As a reference, I used the .SHP.zip file from this ...
0
votes
0
answers
46
views
How to write/ export raster stack as NetCDF file without losing layer values
I currently have a raster stack of environmental data, where each layer is a daily mean value. Reading/ importing this into R and analysing it works fine. However, when I write/ export it as a NetCDF ...
0
votes
0
answers
27
views
Merging 2 netCDF files leading to empty dimensions & variables
I'm trying to merge 2 netCDF files following the recommendation suggested at Combine multiple NetCDF files into timeseries multidimensional array python. The line to combine the file reads:
dataset = ...
0
votes
0
answers
81
views
How to read multiple netcdf files from GCP bucket storage in Python
I have the following code that lists all the files matching a naming pattern in my Google Cloud bucket storage
from google.cloud import storage
def list_files(bucket_name, prefix):
""&...