Questions tagged [nco]

NCO is the acronym standing for netCDF Operators, a collection of standalone operators that manipulate data stored in netCDF-accessible formats, including HDF4 and HDF5. It is frequently used on NCAR, NASA, NOAA, and model climate and weather datasets.

NCO is the acronym standing for netCDF Operators, a collection of standalone programs that manipulate data stored in netCDF-accessible formats, including HDF4 and HDF5. It is frequently used on NCAR, NASA, NOAA, and model climate and weather datasets.

References

245 questions
14
votes
3 answers

Is there a way to crop a NETCDF file?

Imagine that you have a file example.nc, that has wind data defined in 90N, 90S, 180E, 180W region. Is there anyway I could in linux, with a simple nc-type command (without extracting the data in matlab/python to rewrite), crop this file to include…
jhc
  • 1,739
  • 3
  • 21
  • 46
12
votes
7 answers

netcdf4 extract for subset of lat lon

I would like to extract a spatial subset of a rather large netcdf file. From Loop through netcdf files and run calculations - Python or R from pylab import * import netCDF4 f =…
user308827
  • 21,227
  • 87
  • 254
  • 417
9
votes
4 answers

Python : Replacing Values in netcdf file using netCDF4

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 =…
user308827
  • 21,227
  • 87
  • 254
  • 417
9
votes
1 answer

Delete a dimension in a NetCDF file

I have a netCDF file with 8 variables and 4 dimensions: latitude (dim: 26), longitude (dim:17), time (dim: a lot) and level (dim:1, pressure level). In order to use it in a specific program I need to have only 3 dimensions: latitude, longitude and…
Douie
  • 201
  • 4
  • 11
8
votes
2 answers

NCO: Extract a variable from NetCDF file using NCO ncks

I am trying to extract a variable from a multi-variable netcdf file, by entering the command: ncks -v ta temp1.nc out.nc However then I look at the out.nc header, all the variables are still there. The headers of both temp1.nc and out.nc are…
F. Brazil
  • 199
  • 1
  • 1
  • 10
7
votes
2 answers

Efficient way to extract data from NETCDF files

I have a number of coordinates (roughly 20000) for which I need to extract data from a number of NetCDF files each comes roughly with 30000 timesteps (future climate scenarios). Using the solution here is not efficient and the reason is the time…
Seji
  • 371
  • 1
  • 10
7
votes
2 answers

How to calculate number of missing values summed over time dimension in a netcdf file in bash

I have a netcdf file with data as a function of lon,lat and time. I would like to calculate the total number of missing entries in each grid cell summed over the time dimension, preferably with CDO or NCO so I do not need to invoke R, python etc. I…
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
7
votes
3 answers

How to convert fixed size dimension to unlimited in a netcdf file

I'm downloading daily 600MB netcdf-4 files that have this structure: netcdf myfile { dimensions: time_counter = 18 ; depth = 50 ; latitude = 361 ; longitude = 601 ; variables: salinity temp, etc …
Favo
  • 818
  • 6
  • 15
6
votes
1 answer

How to project x,y coordinates to lat/lon in netcdf file

I have downloaded the velocity field of the Greenland ice sheet from the CCI website as a NetCDF file. However, the projection is given as (see below, where x ranges between [-639750,855750] and y [-655750,-3355750]) How can I project these data to…
5
votes
3 answers

Monthly sum of wet days from daily data using Climate Data Operators (CDO)

I have climate data with a daily temporal resolution and would like a count of days that have precipitation (e.g., greater than 1mm/day) by month and by year. I've tried eca_pd,1 and eca_rr1, but these commands return wet-day totals for all…
derelict
  • 3,657
  • 3
  • 24
  • 29
5
votes
1 answer

How to edit global attributes in netcdf file with NCO

I am trying to edit one of the global attributes in my netcdf file: START_DATE = "2016-05-12_00:00:00" I want to change the date string to another date. How do you do this with the nco package? I've seen that I can use ncatted [-a ...] [-D…
meteo_96
  • 289
  • 2
  • 11
5
votes
2 answers

Extracting only bottom temperature from 4d NetCDF file

I have a NetCDF file for ocean temperature. It has 1 variable ('temp') and 4 dimensions (time, lon, lat, and depth). I would like to extract temperature only at maximum depth for each time, lon, and lat to obtain a bottom sea temperature raster…
zoek
  • 141
  • 1
  • 7
5
votes
3 answers

subtracting variables within two different netcdf files

I have two netcdf files: downwelling radiation named rsds.nc and confined radiation named rsns.nc. rsds.nc contains a variable named rsds and rsns.nc contains a variable named rsns. Now I would like to have the upwelling radiation rsus.nc by…
David Halley
  • 417
  • 3
  • 6
  • 18
5
votes
5 answers

clipping data - setting values below a threshold to the threshold in a netcdf file

I want to set all values below a constant c to c itself in a netcdf file: file.nc A solution using climate data operators (CDO) would be cdo mul -gec,$c file.nc file.nc t1.nc cdo add -mulc,$c -ltc,$c file.nc t1.nc output.nc rm -f t1.nc But is there…
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
5
votes
1 answer

Define a new dimension to one of the variables in netCDF file

I have a NetCDF file which include lots of variables (1d, 2d, 3d, and 4d). I want to add a new dimension to one of the 3d variables. To make it more clear, suppose: I have a 3d variable: A(d1, d2, d3) I want to have 4d variable: A(d1, d2, d3, d4) In…
zhr
  • 419
  • 2
  • 6
  • 14
1
2 3
16 17