2

I'm attempting to concatenate two NetCDF files along the time (record) axis.

The lon dimension has the same number of values in both files, but the first file's lon coordinate values range from 0.5 to 359.5, and the second file's lon coordinate values range from -179.5 to 179.5. So when I view the final time step of the concatenated file plotted in Panoply I see values that look good spatially but which are positioned in the wrong location on the map. I have tried remedying this by adding 180 to all lon values in the second file before performing the concatenation but it produces similar results.

The command I'm using for this:

$ ncrcat precip.mon.total.1x1.v7.nc first_guess_monthly_2014_01.nc combined.nc

Below is the ncdump -h output for the two files I'm concatenating:

netcdf precip.mon.total.1x1.v7 {
dimensions:
        lat = 180 ;
        lon = 360 ;
        time = UNLIMITED ; // (1356 currently)
variables:
        float lat(lat) ;
                lat:units = "degrees_north" ;
                lat:actual_range = -89.5f, 89.5f ;
                lat:long_name = "Latitude" ;
                lat:standard_name = "latitude" ;
                lat:axis = "Y" ;
                lat:coordinate_defines = "point" ;
        float lon(lon) ;
                lon:long_name = "Longitude" ;
                lon:units = "degrees_east" ;
                lon:standard_name = "longitude" ;
                lon:actual_range = 0.5f, 359.5f ;
                lon:axis = "X" ;
                lon:coordinate_defines = "point" ;
        double time(time) ;
                time:long_name = "Time" ;
                time:units = "days since 1800-1-1 00:00:00" ;
                time:delta_t = "0000-01-00 00:00:00" ;
                time:avg_period = "0000-01-00 00:00:00" ;
                time:standard_name = "time" ;
                time:axis = "T" ;
                time:coordinate_defines = "start" ;
                time:actual_range = 36889., 78131. ;
        float p(time, lat, lon) ;
                p:long_name = "GPCC Monthly total of precipitation" ;
                p:missing_value = -9.96921e+36f ;
                p:statistic = "Total" ;
                p:valid_range = 0.f, 8000.f ;
                p:parent_stat = "Observations" ;
                p:var_desc = "Precipitation" ;
                p:actual_range = 0.f, 3153.04f ;
                p:dataset = "GPCC Precipitation 1.0degree V7 Full Reanalysis" ;
                p:units = "mm" ;
                p:level = "Surface" ;

// global attributes:
                :Original_Source = "http://www.dwd.de/en/FundE/Klima/KLIS/int/GPCC/GPCC.htm\n is the webpage and the data is at ftp://ftp.dwd.de/pub/data/gpcc/download.html" ;
                :Reference = "Users of the data sets are kindly requested to give feed back and to refer to GPCC publications on this webpage: http://www.dwd.de/bvbw/appmanager/bvbw/dwdwwwDesktop/?_nfpb=true&_pageLabel=_dwdwww_klima_umwelt_datenzentren_wzn&T12404518261141645246564gsbDocumentPath=Content%2FOeffentlichkeit%2FKU%2FKU4%2FKU42%2Fteaser__product__access.html&_state=maximized&_windowLabel=T12404518261141645246564&lastPageLabel=_dwdwww_klima_umwelt_datenzentren_wzn" ;
                :original_source = "ftp://ftp-anon.dwd.de/pub/data/gpcc/html/download_gate.html" ;
                :References = "http://www.esrl.noaa.gov/psd/data/gridded/data.gpcc.html" ;
                :Conventions = "CF 1.0" ;
                :title = "GPCC Full Data Reanalysis Version 7 1.0x1.0 Monthly Totals" ;
                :dataset_title = "Global Precipitation Climatology Centre (GPCC)" ;
                :history = "Tue Jun 14 10:59:21 2016: ncrename -v precip,p precip.mon.total.1x1.v7.nc\nCreated 01/2016 based on V7 data obtained via ftp" ;



netcdf first_guess_monthly_2014_01 {
dimensions:
        lon = 360 ;
        lat = 180 ;
        time = UNLIMITED ; // (1 currently)
variables:
        double lon(lon) ;
                lon:standard_name = "longitude" ;
                lon:long_name = "longitude" ;
                lon:units = "degrees_east" ;
                lon:axis = "X" ;
        double lat(lat) ;
                lat:standard_name = "latitude" ;
                lat:long_name = "latitude" ;
                lat:units = "degrees_south" ;
                lat:axis = "Y" ;
        double time(time) ;
                time:standard_name = "time" ;
                time:units = "months since 2014-01-01 00:00:00" ;
                time:calendar = "proleptic_gregorian" ;
        float p(time, lat, lon) ;
                p:long_name = "first guess monthly product, precipitation per grid" ;
                p:units = "mm/month" ;
                p:code = 20 ;
                p:_FillValue = -99999.99f ;
        float s(time, lat, lon) ;
                s:long_name = "first guess monthly product, number of gauges per grid" ;
                s:units = "gauges per gridcell" ;
                s:code = 21 ;
                s:_FillValue = -99999.99f ;

// global attributes:
                :CDI = "Climate Data Interface version 1.5.9 (http://code.zmaw.de/projects/cdi)" ;
                :Conventions = "CF-1.4" ;
                :history = "Mon Apr 07 10:41:42 2014: cdo -setgatts,gattfile gpcc10.nc first_guess_monthly_2014_01.nc\n",
                        "Mon Apr 07 10:41:41 2014: cdo -merge first_guess_monthly_precip_2014_01.nc first_guess_monthly_numgauge_2014_01.nc gpcc10.nc\n",
                        "Mon Apr 07 10:41:41 2014: cdo cat gpcc10.nc first_guess_monthly_numgauge_2014_01.nc\n",
                        "Mon Apr 07 10:41:41 2014: cdo -b F32 -r -f nc -setgrid,firstguess10desc.asc -settunits,month -setmissval,-99999.99 -setpartab,codetable.txt -setcode,21 -setdate,2014-01 -input,r360x180 gpcc10.nc" ;
                :DOI = "10.5676/DWD_GPCC/FG_M_100" ;
                :title = "GPCC First Guess Product at 1.0°: Near Real-Time First Guess Monthly Land-Surface Precipitation from Rain-Gauges based on SYNOP Data" ;
                :summary = "This is the GPCC First Guess Product of monthly global land-surface precipitation based on the station database (SYNOP) available via the Global Telecommunication System (GTS) of the World Meteorological Organization (WMO) at the time of analysis (3 - 5 days after end of the analysis month). This product contains the monthly totals on a regular latitude/longitude grid with a spatial resolution of 1.0° x 1.0° latitude by longitude. Interpolation is made on the anomalies from the GPCC Climatology V2011 in the corresponding resolution (DOI: 10.5676/DWD_GPCC/Clim_M_V2011_100). The temporal coverage of the dataset ranges from January 2005 until the most recent month for which GTS based SYNOP data is available, i.e. the previous month, 3-5 days after its completion." ;
                :usage = "This GPCC product is recommended to be used when the timeliness of the precipitation information is of highest importance, e.g. for drought monitoring or watch purposes." ;
                :keywords = "precipitation climatology,gpcc,global,gpcp,daily" ;
                :id = "first_guess_monthly_precipitation_10" ;
                :creator_url = "http://gpcc.dwd.de" ;
                :creator_name = "GPCC/DWD" ;
                :creator_email = "gpcc@dwd.de" ;
                :institution = "Deutscher Wetterdienst" ;
                :date_created = "Mo 7. Apr 10:41:41 UTC 2014" ;
                :time_coverage_start = "2014-01" ;
                :time_coverage_end = "2014-01" ;
                :time_coverage_resolution = "month" ;
                :geospatial_lat_min = "-90." ;
                :geospatial_lat_max = "90." ;
                :geospatial_lon_min = "-180." ;
                :geospatial_lon_max = "180." ;
                :CDO = "Climate Data Operators version 1.5.9 (http://code.zmaw.de/projects/cdo)" ;
}

What might I be doing wrong?

halfer
  • 19,824
  • 17
  • 99
  • 186
James Adams
  • 8,448
  • 21
  • 89
  • 148
  • Can you show the first few values of `lon` for the two files you're trying to concatenate? Global attributes in the `first_guess.nc` file suggest that `lon` here is -180 to 180. – N1B4 Jun 15 '16 at 14:31

1 Answers1

0

I know this is 4 years too late, but did you try to use CDO?

cdo mergetime file1.nc file2.nc merged_file.nc 

I think it can automatically handle the shifted longitude issue in cases like this.

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86