[gradsusr] How to combine netcdf files.

Jeff Duda jeffduda319 at gmail.com
Mon Dec 10 12:34:00 EST 2012


When using CHSUB, you only use the template strings %ch.  In your case you
shouldn't need to use any other template strings.

Jeff

On Mon, Dec 10, 2012 at 12:32 AM, Muhammad Yunus Ahmad Mazuki <
ukm.yunus at gmail.com> wrote:

> I find that in using the template options, in the dset, %x3 does not work
> for me.
> file name ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_200601-202512.nc
>               ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_202601-204512.nc
> dset ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_%x3601-%x3512.nc this does not
> work in diplaying data, it will say "Cannot contour grid - all undefined
> values"
> dset ua_Amon_CSIRO-Mk3-6-0_rcp45_r1i1p1_%ch.nc however works.
> chsub 1 240 200601-202512
> chsub 241 480 202601-204512
> TDEF 480 Linear 12:00z01jan2006 1mo
>
> I do think that%x3601-%x3512 should be replaced with %y401-%y412. This
> does not work as well. Does this mean in using the substitution template
> like %x, %y and others, the increment must be 1? Since using %ch is
> considered as string, it works well with 20 years increment in my files
> name, I just considered "200601-202512" and "200601-202512" as strings.
>
> To Jeff, you mean the dtype does not need change. dset need to be changet
> to reflect the filename increment.
>
> Yunus
>
> On Fri, Dec 7, 2012 at 1:27 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> 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/20121210/d71fb1a8/attachment-0003.html 


More information about the gradsusr mailing list