[ncl-talk] Modifying variable in ncfile

Rashed Mahmood rashidcomsis at gmail.com
Sun Sep 15 05:41:21 MDT 2019


Hi Pavani,
You do not need the loop in this case. The following would do the same as
in your loop:

f->ALBEDO(0,mn(:,0),mn(:,1))=0.1200218
f->ALBEDO(1,mn(:,0),mn(:,1))=0.12
f->ALBEDO(2,mn(:,0),mn(:,1))=0.1203444
f->ALBEDO(3,mn(:,0),mn(:,1))=0.1250593
f->ALBEDO(4,mn(:,0),mn(:,1))=0.1295258
f->ALBEDO(5,mn(:,0),mn(:,1))=0.139174
f->ALBEDO(6,mn(:,0),mn(:,1))=0.1493438
f->ALBEDO(7,mn(:,0),mn(:,1))=0.1549511
f->ALBEDO(8,mn(:,0),mn(:,1))=0.143491
f->ALBEDO(9,mn(:,0),mn(:,1))=0.1334304
f->ALBEDO(10,mn(:,0),mn(:,1))=0.1294655
f->ALBEDO(11,mn(:,0),mn(:,1))=0.1244921

This should only take a few seconds/minutes!!
Cheers,
Rashed






On Sun, Sep 15, 2019 at 4:20 AM Goriparthi Pavani via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hi,
>
> I am trying to modify variable(albedo) in ncfile over some gridpoints in
> the given domain.The time for completing this task is taking 7days.I still
> need to modify two more variables.Is there any better way to do this so
> that this task can complete in lesser time?
>
> The code I wrote is:
> ------------------------------------------------------------------
> f=addfile("modlis_input.d01.nc","w")
> mn=asciiread("latlonmod.txt",(/47425,2/),"integer")
> do i=0,47424
> f->ALBEDO(0,mn(i,0),mn(i,1))=0.1200218
> f->ALBEDO(1,mn(i,0),mn(i,1))=0.12
> f->ALBEDO(2,mn(i,0),mn(i,1))=0.1203444
> f->ALBEDO(3,mn(i,0),mn(i,1))=0.1250593
> f->ALBEDO(4,mn(i,0),mn(i,1))=0.1295258
> f->ALBEDO(5,mn(i,0),mn(i,1))=0.139174
> f->ALBEDO(6,mn(i,0),mn(i,1))=0.1493438
> f->ALBEDO(7,mn(i,0),mn(i,1))=0.1549511
> f->ALBEDO(8,mn(i,0),mn(i,1))=0.143491
> f->ALBEDO(9,mn(i,0),mn(i,1))=0.1334304
> f->ALBEDO(10,mn(i,0),mn(i,1))=0.1294655
> f->ALBEDO(11,mn(i,0),mn(i,1))=0.1244921
> end do
>
> -----------------------------------------------------------------------------
>
> Thanks,
> Pavani
> _______________________________________________
> 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/20190915/8662f725/attachment.html>


More information about the ncl-talk mailing list