Levy,Ilan [Ontario]
2009-May-01 16:03 UTC
[R] Copying ncdf dims and vars from one file to the other
Hi, all I have a large number of NetCDF files that I need to average and then put the mean in a new NetCDF file. My problem is that I do this every time for files with different variables, so I do not want to hard-code the variables in the new NetCDF file I creat. does anyone know how I can copy ALL the dimensions and variables from one NetCDF file to another, and just put the mean I calculated as data? Below is an example of the dump file from one of the input files. Thanks, I.L. Environment Canada netcdf E:/Data/AURAMS/Output/2_5km/species_2_5km_20070621_O3.nc { dimensions: xc = 157; yc = 211; level = 28; time = UNLIMITED; // (144 currently) variables: char polar_stereographic; :grid_mapping_name = "polar_stereographic"; :straight_vertical_longitude_from_pole = -110.0f; // float :standard_parallel = 60.0f; // float :false_easting = -2264501.0f; // float :false_northing = 4844997.5f; // float :latitude_of_projection_origin = 90.0f; // float :resolution_at_standard_parallel = 2500.0f; // float :_CoordinateTransformType = "Projection"; :_CoordinateAxisTypes = "GeoX GeoY"; double O3_(time=144, level=28, yc=211, xc=157); :units = "ppb"; :long_name = "O3"; :actual_range = 1.3366962775762659E-5, 700.8307495117188; // double :coordinates = "lon lat"; :grid_mapping = "polar_stereographic"; :level_desc = "Height"; :grid_desc = "polar_stereographic"; float xc(xc=157); :units = "m"; :long_name = "x-coordinate of polar-stereographic projection"; :standard_name = "projection_x_coordinate"; :axis = "X"; :coordinate_defines = "point"; :actual_range = 0.0, 390000.0; // double :_CoordinateAxisType = "GeoX"; float yc(yc=211); :units = "m"; :long_name = "y-coordinate of polar-stereographic projection"; :standard_name = "projection_y_coordinate"; :axis = "Y"; :coordinate_defines = "point"; :actual_range = 0.0, 525000.0; // double :_CoordinateAxisType = "GeoY"; float level(level=28); :units = "m"; :long_name = "height"; :standard_name = "height"; :axis = "Z"; :positive = "up"; :coordinate_defines = "point"; :actual_range = 0.0, 18670.0; // double :_CoordinateAxisType = "Height"; :_CoordinateZisPositive = "up"; double time(time=144); :long_name = "time"; :standard_name = "time"; :axis = "T"; :units = "minutes since 2007-06-17 00:00:0.0"; :delta_t = "0000-00-00 00:10:00"; :coordinate_defines = "point"; :actual_range = 5770.0, 7200.0; // double :_CoordinateAxisType = "Time"; float lon(yc=211, xc=157); :units = "degrees_east"; :long_name = "longitude"; :standard_name = "longitude"; :actual_range = 275.0508346557617, 281.5693588256836; // double :_CoordinateAxisType = "Lon"; float lat(yc=211, xc=157); :units = "degrees_north"; :long_name = "latitude"; :standard_name = "latitude"; :actual_range = 40.151729583740234, 45.38578414916992; // double :_CoordinateAxisType = "Lat"; :Conventions = "CF-1.0"; :title = "AURV-PPBV 2_5km/species_2_5km_20070621_O3.fst"; } [[alternative HTML version deleted]]
Seemingly Similar Threads
- mgcv (bam) very large standard error difference between versions 1.7-11 and 1.7-17, bug?
- read a netcdf file _Fill_value=-32768
- Extracting subset from netCDF file using lat/lon and converting into .csv in R
- Editing the variables attributes section in the netCDF header of netCDF files created using the package ncdf.
- Extracting subset from netCDF file using lat/lon and converting into .csv in R