[ncl-talk] ncl-talk Digest, Vol 145, Issue 14

Mark.Collier at csiro.au Mark.Collier at csiro.au
Sun Dec 13 16:23:14 MST 2015


Hi Xiyue,
I wrote a NCL script recently to process the data that Adam points you to. There are a couple of simple  system calls with external dependencies that could potentially be removed by using just NCL functions alone, but I found it easier at the time. You will need to load in the standard NCL functions at the beginning rather than mine. It produces a daily file spanning the required years specified at the beginning. You will need to edit input/output directories. Good luck,
Mark.

> On 12 Dec 2015, at 6:00 AM, ncl-talk-request at ucar.edu wrote:
>
> Send ncl-talk mailing list submissions to
>        ncl-talk at ucar.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> or, via email, send a message with subject or body 'help' to
>        ncl-talk-request at ucar.edu
>
> You can reach the person managing the list at
>        ncl-talk-owner at ucar.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ncl-talk digest..."
>
>
> Today's Topics:
>
>   1. modifing "Times" in netcdf file (Mark Chan)
>   2. Re: spliting large files (Mary Haley)
>   3. Superscript in text (Tabish Ansari)
>   4. Re: Superscript in text (jbuzan)
>   5. Re: Superscript in text (Tabish Ansari)
>   6. Re: Reading multiple hdf-eos files in an array (Mary Haley)
>   7. Re: overlay plots (Mary Haley)
>   8. GPCP data set (Xiyue Liao)
>   9. Re: GPCP data set (Adam Phillips)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 11 Dec 2015 11:35:52 +0000 (UTC)
> From: Mark Chan <cym263 at yahoo.com>
> Subject: [ncl-talk] modifing "Times" in netcdf file
> To: Talk NCL <ncl-talk at ucar.edu>
> Cc: Mark Chan <cym263 at yahoo.com>
> Message-ID:
>        <314758331.818950.1449833752947.JavaMail.yahoo at mail.yahoo.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear NCL group,
> I am wondering whether there is any easy method with NCL to modify "internal Times" of the netcdf file: (the file name would be changed later)
>
> from: met_em_d01_1987-04-13_12:00:00
>
> To:??? met_em_d01_1987-04-13_18:00:00
> So the time could be shown as (with "ncdump -v Times")
> ?Times = ? "1978-04-13_18:00:00" ;
> Thanks very much in advance!!!Mark
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/952883e2/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Fri, 11 Dec 2015 08:39:00 -0700
> From: Mary Haley <haley at ucar.edu>
> Subject: Re: [ncl-talk] spliting large files
> To: Benjamin Alabi <alabibenjamin2 at gmail.com>
> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
> Message-ID:
>        <CACNN_CKdiTtorVvSS0VJFTHEdDQbTspQpb-=vCbASsRe-iamwA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Benjamin,
>
> Please write to the NCO help email for information on this. These tools are
> tailored for working on sets of NetCDF files in this fashion.
>
> http://nco.sourceforge.net/#Support
>
> --Mary
>
>
> On Tue, Dec 8, 2015 at 5:07 AM, Benjamin Alabi <alabibenjamin2 at gmail.com>
> wrote:
>
>> Please sir, How can I split wrfout large files(30GB) into small files
>> using ncl or nco that wrfout_to_cf.ncl would be able to convert to pressure
>> level.
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/5ed7ad70/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Fri, 11 Dec 2015 15:44:15 +0000
> From: Tabish Ansari <tabishumaransari at gmail.com>
> Subject: [ncl-talk] Superscript in text
> To: "ncl-talk at ucar.edu USERS" <ncl-talk at ucar.edu>
> Message-ID:
>        <CALLVTyvrWfiaTCY2ydkF+fDXZpUEypQukKsd_G2PYctFeh6DvA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi
>
> If I need to write *mol km-2 hr-1* with "-2" and "-1" as superscripts how
> can I achieve that in NCL?
>
> Thanks in advance!
>
> regards,
>
> Tabish
>
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster,
> LA1 4YW, United Kingdom
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/9e8dda74/attachment-0001.html
>
> ------------------------------
>
> Message: 4
> Date: Fri, 11 Dec 2015 10:46:25 -0500
> From: jbuzan <jbuzan at purdue.edu>
> Subject: Re: [ncl-talk] Superscript in text
> To: Tabish Ansari <tabishumaransari at gmail.com>
> Cc: "ncl-talk at ucar.edu USERS" <ncl-talk at ucar.edu>
> Message-ID: <070FD09C-9DCF-4F6B-B832-9B3930D6B396 at purdue.edu>
> Content-Type: text/plain; charset="us-ascii"
>
> Here is an example:
> https://www.ncl.ucar.edu/Applications/Scripts/text_7.ncl <https://www.ncl.ucar.edu/Applications/Scripts/text_7.ncl>
>
> -Jonathan
>
>
>> On Dec 11, 2015, at 10:44 AM, Tabish Ansari <tabishumaransari at gmail.com <mailto:tabishumaransari at gmail.com>> wrote:
>>
>> Hi
>>
>> If I need to write mol km-2 hr-1 with "-2" and "-1" as superscripts how can I achieve that in NCL?
>>
>> Thanks in advance!
>>
>> regards,
>>
>> Tabish
>>
>> Tabish U Ansari
>> PhD student, Lancaster Environment Center
>> Lancaster Univeristy
>> Bailrigg, Lancaster,
>> LA1 4YW, United Kingdom
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/ce11cbf8/attachment-0001.html
>
> ------------------------------
>
> Message: 5
> Date: Fri, 11 Dec 2015 15:55:54 +0000
> From: Tabish Ansari <tabishumaransari at gmail.com>
> Subject: Re: [ncl-talk] Superscript in text
> To: jbuzan <jbuzan at purdue.edu>
> Cc: "ncl-talk at ucar.edu USERS" <ncl-talk at ucar.edu>
> Message-ID:
>        <CALLVTysiT0YOFM=xyc8fViQM9ywzyOvzjL+rR9DLKyQoTwLUWQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Thanks a lot- it works!
>
> Tabish
>
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster,
> LA1 4YW, United Kingdom
>
> On 11 December 2015 at 15:46, jbuzan <jbuzan at purdue.edu> wrote:
>
>> Here is an example:
>> https://www.ncl.ucar.edu/Applications/Scripts/text_7.ncl
>>
>> -Jonathan
>>
>>
>> On Dec 11, 2015, at 10:44 AM, Tabish Ansari <tabishumaransari at gmail.com>
>> wrote:
>>
>> Hi
>>
>> If I need to write *mol km-2 hr-1* with "-2" and "-1" as superscripts how
>> can I achieve that in NCL?
>>
>> Thanks in advance!
>>
>> regards,
>>
>> Tabish
>>
>> Tabish U Ansari
>> PhD student, Lancaster Environment Center
>> Lancaster Univeristy
>> Bailrigg, Lancaster,
>> LA1 4YW, United Kingdom
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/bd26acad/attachment-0001.html
>
> ------------------------------
>
> Message: 6
> Date: Fri, 11 Dec 2015 09:13:57 -0700
> From: Mary Haley <haley at ucar.edu>
> Subject: Re: [ncl-talk] Reading multiple hdf-eos files in an array
> To: Abdulla Sakalli <as at abdulla-sakalli.com>
> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
> Message-ID:
>        <CACNN_CJnRNKfDv=utSFz+T=YCbbXSKMzOgVXet-0ewN+e-SHSw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> There are a number of issues with your script.
>
> [1]
>
> By default, when you pull a variable off a set of files opened with
> "addfiles", they are "concatenated" (this is known as "cat" mode in NCL)
> across the leftmost dimension.
>
> If you ?use the "join" mode, then a new leftmost dimension will be created
> that will be the same size as the number of files (in your case, 20).
>
> To get "join" mode, uncomment your ListSetType option above and change it
> to:
>
>  ListSetType (f, "join") ;join files
>
> [2]
>
> To get a 4 x 5 configuration rather than a 20 configuration, you can use
> reshape to change the dimensions:
>
>  npp_dims = filevardimsizes(f[0],"Npp_1km_MOD_Grid_MOD17A3")
>  npp      = reshape(short2flt(f[:]->Npp_1km_
> MOD_Grid_MOD17A3),(/4,5,npp_dims(0),npp_dims(1)/))
>
>
> Please see the documentation for "addfiles" for more information:
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
>
> [3]
>
> An issue with using reshape is that you may lose attribute and coordinate
> information, if any. You can use copy_VarAtts and copy_VarCoords to copy
> over any information you need.
>
> See:
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarAtts.shtml
> http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarCoords.shtml
>
> [4]
>
> You are reading two-dimensional latitude and longitude arrays off the file,
> and then trying to treat them as coordinate arrays with:
>
> npp!0="lat2d"
> npp!1="lon2d"
> npp&lat2d=lat2d
> npp&lon2d=lon2d
>
>
> By strict definition, coordinate arrays can only be one-dimensional, and of
> the same size as whatever dimension they are associated with.  Since your
> lat/lon arrays are 2D, you cannot assign them as coordinate arrays.
>
> You can, however, write them separately to the file just like your "npp"
> variable, and then create a "coordinates" attribute (that I see you have
> already) that indicates what the name of the lat/lon arrays are on the new
> file:
>
> npp at coordinates="lon2d lat2d"
>
>
> Note that the "coordinates" attribute generally doesn't have a comma in it.
> Also, if your "npp" variable is 4D, and the other two dimensions have
> variables associated with them, you'll want to include these in the
> "coordinates" setting.  For example, if you had a 3D array, and the
> leftmost dimension was represented by a variable on the file called "time",
> then you would use:
>
> npp at coordinates = "lon2d lat2d time"
>
> For some reason, the coordinates are usually listed right-to-left, although
> I don't think this is required.
>
> [5]
>
> You should use the same dimension names for your "npp" variable that you
> have for the lat2d/lon2d variables:
>
> npp!2 = "nlat"
> npp!3 = "nlon"
>
> Note that I changed these to dimensions 2 and 3, because dimensions 0 and 1
> are associated with the "4 x 5" part of your array. You will need to name
> these accordingly.
>
>
> --Mary
>
>
> On Wed, Dec 9, 2015 at 5:13 AM, Abdulla Sakalli <as at abdulla-sakalli.com>
> wrote:
>
>> Dear List,
>>
>> I downloaded 20 files from MODIS satellite for NPP (MOD17A3). I?d like to
>> read the hdf files and merge it in 4x5 to get the NPP value for
>> pan-European domain. I've been written the fallowing script for my aim.
>> Unfortunately, I get the files merged in 1x20 (i.e. merged along latitude
>> and not lonxlat direction).
>> Can please anyone help me to read the npp from the 20 files and enlarge it
>> in LonxLat direction.
>>
>> Thank you very much in advance
>> Abu
>>
>> Script:
>>
>>
>>
>> load "$NCARG_ROOT/share/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/share/ncarg/nclscripts/csm/gsn_csm.ncl"
>> load "$NCARG_ROOT/share/ncarg/nclscripts/csm/contributed.ncl"
>> load "$NCARG_ROOT/share/ncarg/nclscripts/csm/shea_util.ncl"
>>
>> begin
>>
>> ; 1km annual npp MOD17A3 on 1200x1200 tiles
>>
>> files = systemfunc("ls *.hdfeos")
>>
>> f = addfiles(files,"r")
>> ;print(f)
>> ;ListSetType (f, "cat") ;concatenate files
>>
>> lat2d=f[:]->GridLat_MOD_Grid_MOD17A3
>> lon2d=f[:]->GridLon_MOD_Grid_MOD17A3
>>
>> npp=short2flt(f[:]->Npp_1km_MOD_Grid_MOD17A3)
>>
>> lat2d!0="nlat"
>> lat2d!1="nlon"
>> lon2d!0="nlat"
>> lon2d!1="nlon"
>>
>> ;printVarSummary(lon2d)
>>
>> npp!0="lat2d"
>> npp!1="lon2d"
>> npp&lat2d=lat2d
>> npp&lon2d=lon2d
>> npp at coordinates="lat2d,lon2d"
>> npp at projection="sinusoidal"
>>
>> printVarSummary(npp)
>>
>> system("rm test.nc")
>> out=addfile("test.nc","c")
>> out->npp=npp
>> out->lat2d=lat2d
>> out->lon2d=lon2d
>>
>> end
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *print summary is Variable: npp Type: short Total Size: 57600000 bytes
>>            28800000 values Number of Dimensions: 2 Dimensions and
>> sizes:    [YDim_MOD_Grid_MOD17A3 | 24000] x [XDim_MOD_Grid_MOD17A3 | 1200]
>> Coordinates: Number Of Attributes: 6   lon2d :    <ARRAY of 28800000
>> elements>   lat2d :    <ARRAY of 28800000 elements>   coordinates :
>> lat2d,lon2d   hdfeos_name :    Npp_1km   projection :    sinusoidal
>> unsigned :    True *
>>
>> ---------------------------------------------------------------------------
>> Asst. Prof. Abdulla Sakalli
>>
>> Iskenderun Technical University
>> Faculty of Marine Sciences & Technology
>> Dept. Water Resources Management and Organization
>> Meydan Mah. 512 Sk
>> Iskenderun-Hatay-Turkey
>> as at abdulla-sakalli.com <http://www.abdulla-sakalli.com>
>> asakalli at istek.edu.tr <asakalli at mku.edu.tr>
>> +90 326 614 1693 (330)
>> +90 536 506 9191
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/a769f5f1/attachment-0001.html
>
> ------------------------------
>
> Message: 7
> Date: Fri, 11 Dec 2015 09:24:00 -0700
> From: Mary Haley <haley at ucar.edu>
> Subject: Re: [ncl-talk] overlay plots
> To: Geeta Geeta <geetag54 at yahoo.com>
> Cc: "ncl-talk \[ncl-talk\]" <ncl-talk at ucar.edu>
> Message-ID:
>        <CACNN_C+X95stBzOTEd2f+ydseb8m6AAp=MQTJ4Rp4QUDMXYs5g at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Geeta,
>
> Your PS file was blank, and you didn't provide enough information for us to
> help.
>
> Do you want to create 10 different frames, each with its own plot, or do
> you want to create a panel of 10 plots, or do you want to overlay 10 plots
> on top of one map?
>
> You also didn't indicate which variables are the ones that you have 10
> different dates for. Are these variables on different files? The same file?
>
> --Mary
>
>
>
>
> On Wed, Dec 9, 2015 at 10:05 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
>
>> hi all.
>> i have been able to overlay 300hPa gpm height on to the wind vectors at
>> 850hPa.
>> i want to know if i have to do this for 10 plots (different dates) how i
>> should do???
>> attatched my script n figure
>>
>> pls suggest
>>
>> Geeta.
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/a3f4fa8f/attachment-0001.html
>
> ------------------------------
>
> Message: 8
> Date: Fri, 11 Dec 2015 10:53:19 -0700
> From: Xiyue Liao <liaoxiyue2011 at gmail.com>
> Subject: [ncl-talk] GPCP data set
> To: ncl-talk at ucar.edu
> Message-ID:
>        <CAC7dBHSd_0Dgm2hWZfKvt5=2vDYJ7rVMyP5ayvROueKA+1UVrA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Mary,
>
> I'm looking at the examples of the Global Precipitation Climatology Project
> (GPCP) at https://www.ncl.ucar.edu/Applications/gpcp.shtml. Is it possible
> that I can get the data set GPCP_1DD.199610-200908.nc which is used in the
> third example gpcp_3.ncl?
>
> Thanks a lot!!
>
> Xiyue
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/026f55d4/attachment-0001.html
>
> ------------------------------
>
> Message: 9
> Date: Fri, 11 Dec 2015 11:52:16 -0700
> From: Adam Phillips <asphilli at ucar.edu>
> Subject: Re: [ncl-talk] GPCP data set
> To: Xiyue Liao <liaoxiyue2011 at gmail.com>
> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
> Message-ID:
>        <CACvWuqBjOAE2s5kOBLBWWo7atXdVRPPE1727CasFoE1qEU5i7A at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Xiyue,
> I do not believe we still have that .nc file. You can download the daily
> binary files directly from NASA here:
> http://precip.gsfc.nasa.gov/
> the specific daily files are located here:
> ftp://rsd.gsfc.nasa.gov/pub/1dd-v1.2/
>
> Then, looking at the NCL GPCP examples page at the top there is a ncl
> script that converts the binary data to a netCDF file:
> https://www.ncl.ucar.edu/Applications/Scripts/gpcp_1DD.bin2nc.ncl
>
> Note that you may have to update that script as the binary data is now
> version 1.2.
>
> Hope that helps!
> Adam
>
> On Fri, Dec 11, 2015 at 10:53 AM, Xiyue Liao <liaoxiyue2011 at gmail.com>
> wrote:
>
>> Hi Mary,
>>
>> I'm looking at the examples of the Global Precipitation Climatology
>> Project (GPCP) at https://www.ncl.ucar.edu/Applications/gpcp.shtml. Is it
>> possible that I can get the data set GPCP_1DD.199610-200908.nc which is
>> used in the third example gpcp_3.ncl?
>>
>> Thanks a lot!!
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/<http://www.cgd.ucar.edu/staff/asphilli/>   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151211/7ee4230f/attachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> End of ncl-talk Digest, Vol 145, Issue 14
> *****************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151213/235ef190/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpcp_daily.ncl
Type: application/octet-stream
Size: 5367 bytes
Desc: gpcp_daily.ncl
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151213/235ef190/attachment.obj 


More information about the ncl-talk mailing list