[gradsusr] How to combine netcdf files.

Jeff Duda jeffduda319 at gmail.com
Fri Dec 7 00:27:28 EST 2012


If you want the data in one file you'll have to use CDO or other netCDF
tools using Fortran or some other programming language.  You can get the
same effect by using templating.  You don't need to change the DSET entry.
 It should be just netcdf.  I'm not 100% the following will work, but it's
worth a try because it won't take much time.  You'll have to determine
exactly how many time indices are contained in each individual file and
keep track of them, because you'll need them for the CHSUB entries.  It
looks like you'll have 4 or 5 entries to write.  You'll want the text of
the substitution string to match what is in the files.  The middle two
numbers should reprsent the time indices in your control file that
correspond to the times in the data.  These indices will depend on your
TDEF entry.  It looks like you are dealing with monthly data, so your TDEF
entry should be something like
TDEF XXX LINEAR 00Z01JAN2010 1MO,
where XXX is the number of months in the combined files.  If you're looking
at 90 years, then this number will probably need to be 90*12+1 = 1081?
(mental math...check it).  Once your TDEF line is specified, the CHSUB
entries should look something like
chsub t1 t2 200601-202512
chsub t2 t3 202601-204512
etc., where t1, t2, and t3 mark specific time indices that mark the start
and end time indices within each file.  t1 is the first time index, so
t1=1.  t2 should be the last time index found in the
file a_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_200601-202512.nc.  If this spans 18
years, then the last time index is probably 12*18+1 = 217.  The next data
file (in temporal order) will start with the next time index, 218, and end
with the additional number of time indices in that specific file.  If that
file is ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_202601-204512.nc, then you
probably have 218+20*12+1 = 459.  Repeat this until you reach the end of
the files.  As a help, the last time index you reach by doing this process
will be the value of XXX you should enter in your TDEF entry.  Don't forget
to add "options template" to your control file.  Try this and see if it
works.

Jeff Duda

On Thu, Dec 6, 2012 at 7:57 PM, Muhammad Yunus Ahmad Mazuki <
ukm.yunus at gmail.com> wrote:

> If I want to use the template option, for example file name
> "ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_200601-202512.nc",
> "ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_202601-204512.nc",
> "ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_204601-206512.nc" and
> "ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_206601-208512.nc",
> "ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_208601-210012.nc", how do I configure
> the DSET, and CHSUB? If possible, I actually just wanted 2010-2100 in one
> file.
>
> On Wed, Dec 5, 2012 at 1:12 PM, Furrukh Bashir <furrukhbashir at gmail.com>wrote:
>
>> Dear Fahim Ahmed
>> You may use NCO as well.
>> http://linux.die.net/man/1/ncrcat
>>
>> Regards
>>
>>
>> *FURRUKH BASHIR*
>> *Pakistan Meteorological Department
>> Research and Development Division
>> Islamabad, Pakistan
>> Mob: 0321-5876770
>> Office Phone: +92 51 9250334*
>>
>>
>>
>> On Wed, Dec 5, 2012 at 1:55 PM, NAGARAJU CHILUKOTI <
>> chilukotinagaraju at gmail.com> wrote:
>>
>>> Hi !!!
>>>
>>>  you can do with CDO climate data operators (CDO)
>>>
>>>      with cdo mergetimes command
>>>
>>>    full details you can find here
>>> https://code.zmaw.de/projects/cdo/wiki/Cdo#Documentation
>>>
>>> I hope this will solve your problem
>>>
>>>
>>> With Cheers
>>>
>>> On Wed, Dec 5, 2012 at 8:10 AM, fahim ahmad <fahimpmd at yahoo.com> wrote:
>>>
>>>> Hi I have downloaded Meteorological Forcing dataset (Daily) from NCEP
>>>> in order to run CLM (Community Land Model). Dataset include 7 different
>>>> variables, for each year one file. I want to combine data in monthly files.
>>>> for example in the file 1985-12.nc i want to combine daily data of all
>>>> the 7 variables. Using grads how can i do this. or if any one has Fortran
>>>> script??
>>>> Thank you very much.
>>>>
>>>> **************************************
>>>> Muhammad FAHIM Ahmad,
>>>> PhD Scholar,
>>>> Nanjing Univ. of Info. Science & Tech.
>>>> Nanjing, China P.R.
>>>> Cell# +8615715191564.
>>>> **************************************
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>
>>>>
>>>
>>>
>>> --
>>>  Nagaraju Chilukoti
>>>  Computational Earth Science Group,
>>>  Centre for Development of Advanced Computing (CDAC)
>>>  Pune University Campus, Ganeshkhind
>>>  Pune 411007
>>>  *020- 25704226*
>>>  Mob.* 08087384939*
>>>  nagarajuc at cdac.in <http://goog_932359822>
>>>  chilukotinagaraju at gmail.com
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20121206/314dfda3/attachment-0003.html 


More information about the gradsusr mailing list