[ncl-talk] How to combine many separate nc files together and convert them to monthly?

Setareh Rahimi setareh.rahimi at gmail.com
Thu Jun 30 07:37:07 MDT 2022


Dear Adam,
So many thanks for your help. I could fix it now!
Best wishes,

On Wed, Jun 29, 2022 at 11:15 PM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Setareh,
> You can remove the left subtitle by setting gsnLeftString = "".
> Alternatively, you can leave that subtitle alone and move the main title up
> by using tiMainString instead of gsnCenterString.
> See: https://www.ncl.ucar.edu/Applications/title.shtml
> Adam
>
> On Tue, Jun 28, 2022 at 5:47 PM Setareh Rahimi via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear Dennis,
>> So many thanks for your help. I could finally run the script
>> successfully. I attached the script and the plot. However, I would like to
>> set the title of the plot as "NDVI average from 2021-03-03 to 2021-03-12"
>> But this title overlaps with the main title of the file. How can I remove
>> the original title, please?
>> So many thanks for the time you allocate to check my request.
>> Best wishes,
>>
>>
>> On Wed, Jun 29, 2022 at 12:57 AM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> The file you sent,
>>>
>>> VIIRS-Land_v001-preliminary_NPP13C1_S-NPP_20210312_c20220419124706.nc
>>>
>>> does not have a problem.
>>>
>>> As you requested, I ran *https://www.ncl.ucar.edu/Applications/Scripts/ndvi_3.ncl
>>> <https://www.ncl.ucar.edu/Applications/Scripts/ndvi_3.ncl>*
>>> on the file you sent*, I*t is appended.
>>>
>>> %> ncl  setareh_VIIRS.ncl
>>>
>>> As you requested, I ran the script  on the VIIRS file. It ran
>>> successfully. The png is attached.
>>> I think it would be best to send help requests to ncl-talk.
>>> Maybe others can see issues that I am not seeing.
>>>
>>> Regards
>>> Dennis
>>>
>>>
>>>
>>> On Tue, Jun 28, 2022 at 1:42 PM Setareh Rahimi <setareh.rahimi at gmail.com>
>>> wrote:
>>>
>>>> Dear Dennis,
>>>> I tried to plot NDVI for a specific day, hence 12 March 2021 using the
>>>> file available at :
>>>> https://www.ncl.ucar.edu/Applications/Scripts/ndvi_3.ncl
>>>> However, I got an error again. It seems that there is a problem with
>>>> the file. I attached the error message and the nc file. May I ask you
>>>> please to run the script for this data?
>>>> I need to make sure that the file is damaged.
>>>> Thanks in advance,
>>>>  VIIRS-Land_v001-preliminary_NPP13C1_S-NPP_20210...
>>>> <https://drive.google.com/file/d/12H5UHVPVoQisuBgo62hs4-66_B7OVXS_/view?usp=drive_web>
>>>>
>>>> On Tue, Jun 28, 2022 at 11:35 PM Dennis Shea <shea at ucar.edu> wrote:
>>>>
>>>>> These messages do not even look like NCL error messages.
>>>>>
>>>>> If you entered the following at the command line and got those
>>>>> messages, NCL in not involved.:
>>>>>
>>>>> %>  ls [1-2][8-9-0-1]*/*nc
>>>>>
>>>>> I'm not sure what to suggest.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jun 28, 2022 at 12:59 PM Setareh Rahimi <
>>>>> setareh.rahimi at gmail.com> wrote:
>>>>>
>>>>>> Dear Dennis,
>>>>>> Thanks again for your advice. I did as you suggested and again got an
>>>>>> error. (attached)
>>>>>> Why should I receive this message, please?
>>>>>> ================================================
>>>>>> ncattname: ncid 23986176: NetCDF: Variable not found
>>>>>> ncattname: ncid 23986176: NetCDF: Variable not found
>>>>>> ncattname: ncid 23986176: NetCDF: Variable not found
>>>>>> ncattname: ncid 23986176: NetCDF: Variable not found
>>>>>> ncattname: ncid 23986176: NetCDF: Variable not found
>>>>>> file: NclNetCDF4.c, line: 2493
>>>>>>
>>>>>> We Thought It Was Compound Data, But NOT.
>>>>>> ================================================
>>>>>>
>>>>>> On Tue, Jun 28, 2022 at 11:23 PM Dennis Shea <shea at ucar.edu> wrote:
>>>>>>
>>>>>>> NCL's *systemfunc* is invoking the Unix/Linux system 'ls'. It is
>>>>>>> *independent* of NCL.
>>>>>>>
>>>>>>> From directory your NCL script is located, enter the following at
>>>>>>> the command line:
>>>>>>>
>>>>>>> %>  ls [1-2][8-9-0-1]*/*nc
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jun 28, 2022 at 11:46 AM Setareh Rahimi <
>>>>>>> setareh.rahimi at gmail.com> wrote:
>>>>>>>
>>>>>>>> Dear Dennis,
>>>>>>>> Many thanks for your email. I run the attached script and received
>>>>>>>> the attached error.
>>>>>>>> What is wrong, please?
>>>>>>>>
>>>>>>>> On Tue, Jun 28, 2022 at 10:07 PM Dennis Shea <shea at ucar.edu> wrote:
>>>>>>>>
>>>>>>>>> As indicated before, your path is wrong.
>>>>>>>>> ====
>>>>>>>>> The attached works just fine.
>>>>>>>>>
>>>>>>>>> %>  ncl NDVI_TimeSeries.ncl >&! NDVI.Daily_to_Monthly.txt
>>>>>>>>>
>>>>>>>>> On Tue, Jun 28, 2022 at 10:25 AM Setareh Rahimi via ncl-talk <
>>>>>>>>> ncl-talk at mailman.ucar.edu> wrote:
>>>>>>>>>
>>>>>>>>>> Dear all,
>>>>>>>>>>
>>>>>>>>>> I have downloaded the Normalized Difference Vegetation Index
>>>>>>>>>> (NDVI), from the Advanced Very High-Resolution Radiometer (AVHRR) sensor
>>>>>>>>>> from the link below:
>>>>>>>>>>
>>>>>>>>>> https://www.ncei.noaa.gov/metadata/geoportal/rest/metadata/item/gov.noaa.ncdc:C01558/html
>>>>>>>>>>
>>>>>>>>>> As you can see this link provides daily data. And I have
>>>>>>>>>> downloaded daily data from 1986 to 2021. I put the daily data for each year
>>>>>>>>>> in a separate folder.
>>>>>>>>>> Now I tend to calculate the monthly anomaly of NDVI and do not
>>>>>>>>>> know how to combine all these files.
>>>>>>>>>>
>>>>>>>>>> I used the below commands to call the files:
>>>>>>>>>> ========================================
>>>>>>>>>> fils = systemfunc("ls [1-2][8-9-0-1]*/*nc")
>>>>>>>>>>    print(fils)
>>>>>>>>>>
>>>>>>>>>>    f   = addfiles (fils, "r")
>>>>>>>>>>
>>>>>>>>>>    x   = short2flt(f[:]->NDVI)
>>>>>>>>>>
>>>>>>>>>>    printVarSummary(x)
>>>>>>>>>> =========================================
>>>>>>>>>> but got the attached error! Please have a look at the attached
>>>>>>>>>> screenshot.
>>>>>>>>>> How can I combine all those files together, please?
>>>>>>>>>> I really appreciate any help you can provide.
>>>>>>>>>> Best wishes,
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> S.Rahimi
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> ncl-talk mailing list
>>>>>>>>>> ncl-talk at mailman.ucar.edu
>>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> S.Rahimi
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>> --
>>>>>> S.Rahimi
>>>>>>
>>>>>>
>>>>
>>>> --
>>>> S.Rahimi
>>>>
>>>>
>>
>> --
>> S.Rahimi
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>


-- 
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220630/98422a86/attachment.htm>


More information about the ncl-talk mailing list