2017年4月12日水曜日

random notes

one way to make existing "time" dimension to be "unlimited": 

cdo seltimestep,1/12 ifile ofile
 
where 1/12 is the first and last indices of your time record. 
Ref: https://code.zmaw.de/boards/1/topics/798


 1057  cdo seltimestep,1/1 sic_G10010_SIBT1850_v1.1-naa_icecon.nc4 sic.nc
 1058  cdo seltimestep,1/1 sit_G10010_SIBT1850_v1.1-naa_icecon.nc4 sic.nc
 1059  cdo seltimestep,1/1 sit_PIOMAS_1979_2013-naa_arlan.nc4 sit.nc 
Add all variables in sic.nc to sit.nc
 1062  ncks -h -A sic.nc sit.nc 
Remove time_counter dimension from the lists of dimensions and variables. 
 1065  ncwa -a time_counter sit.nc sit2.nc





Same names (labels) but different IDs for nodes in PyGraphviz:
 
add_node(1,label=A)
add_node(2,label=B)
add_node(3,label=A)
 
will create three nodes consisting of two As and one B. 
Ref: http://stackoverflow.com/questions/15711909/how-to-create-duplicate-nodes-in-pygraphviz


2017年4月9日日曜日

shaw memo

14 april --> internet 5.
phone disconnect --> immediately.
--> arris --> return to uptown branch.

固定電話とテレビとインターネットのプロバイダーはどこも高くてモノポリー化してるビクトリア :-(

2017年4月5日水曜日

interpolate woa13 no3 field onto NAA grid using SOSIE

I had little trouble interpolating the woa13 no3 data onto NAA grid. SOSIE was creating high values (first figure; set to the prescribed vmax of 100. in this plot) along the coast lines. I was not sure why, but what solved this issue was to change ldrown from F to T:

cf_lsm_in = 'missing_value' ! we use 'missing_value' of input field to determine
cv_lsm_in = ''                ! the land-sea-mask

ldrown    = F            ! we want to propagate sea values onto the land-sea mask


Here, the last line is modified as follows:

ldrown    = T 


Then the interpolation improved (second figure).

Furthermore, the interpolation is not too bad compared to the original file (third figure), although it may underestimate no3 in the beaufort region.

interpolated field with ldrown = F

interpolated field with ldrown = T

comparison between the original 1x1 degree data (left) and the interpolated data (right)

2017年4月3日月曜日

snow and ice melt rate

rdmsnif/rdt_ice is snow melt rate (m/s) averaged over ice covered area, and not over the entire grid cell. Otherwise the code below should include the coefficient "1-frld" in the last term:

limsbc_2.F90

!  computing freshwater exchanges at the ice/ocean interface
            zemp = + emp(ji,jj)     *         frld(ji,jj)      &   !  e-p budget over open ocean fraction 
               &   - tprecip(ji,jj) * ( 1. -  frld(ji,jj) )    &   !  liquid precipitation reaches directly the ocean
               &   + sprecip(ji,jj) * ( 1. - pfrld(ji,jj) )    &   !  change in ice cover within the time step

               &   + rdmsnif(ji,jj) * r1_rdtice                    !  freshwater flux due to snow melting 


2017年3月14日火曜日

iceno3 initialization problem

Issue: iceno3 was initialized to a spatially uniform value defined in PISCES/trcini_pisces.F90. This is not what we want. Later, PISCES jpno3 is updated by initialized by WOA data, which is what we want iceno3 to be initialized with.

Here is to show that iceno3 was initialized to a spatially uniform value across the domain:

 iceno3 initialized to:    31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000
   31.0400000000000        31.0400000000000        31.0400000000000


Here is to show that initialization of my_trc tracers is done before pisces tracers are updated with input data (trcini.F90):


      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model
      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers
      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer
      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers

      IF( lwp ) THEN
         !
         CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
         !
      ENDIF

      IF( ln_trcdta )      CALL trc_dta_init


      IF( ln_rsttr ) THEN
        !
        CALL trc_rst_read              ! restart from a file
        !
      ELSE
        !
        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
            !
            CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )    ! Memory allocation
            !
            CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000
            !
            DO jn = 1, jptra
               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
                  jl = n_trc_index(jn)
                  trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * tmask(:,:,:)
               ENDIF
            ENDDO
            CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
        ENDIF
        !
        trb(:,:,:,:) = trn(:,:,:,:)
        !
      ENDIF
I tried to add the following line just before the second last "ENDIF" statement above:

iceno3(:,:)=trn(:,:,1,jpno3)

However, the compilation error occurred which appears to be related to the ordering:

No rule to make target `trc_sms_my_trc.o', needed by `trcini.o'.

Thus, I had to instead initialize the ice BGC tracers in trcsms_my_trc.F90 instead of trcini_my_trc.F90 as follows:

      IF( kt == nit000 ) THEN
       IF( .NOT. ln_rsttr .AND. ln_trcdta ) THEN
        icedia(:,:) = trn(:,:,1,jpdia)
        write(numout,*) "iceno3 before is: ",iceno3
        iceno3(:,:) = trn(:,:,1,jpno3)
        write(numout,*) "iceno3 after is: ",iceno3
        icenh4(:,:) = trn(:,:,1,jpnh4)
       END IF
      END IF

The output from WRITE statements prove that the values have changed:

 iceno3 before is:   0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
   31.9878976156660        31.0438701002330        31.0369201106744
   31.0369205118954        31.0383482948276        31.0616767301434
   31.0677629528971        31.0492132090291        31.0419920432535
   31.0440657798248        31.0444710620824        31.0447721884932
   31.0375292688435        31.0382076116362        31.0373801558268
   31.0398029146832        31.0397625744607        31.0331636088933
   31.0327651221495        31.0220553651313        31.0230092701832
   31.0342232771140        31.0552545248760        31.0397772061968
   31.0473470388971        31.0546418640872        31.0543800885964


 iceno3 after is:   0.000000000000000E+000  6.051918107557494E-007
  6.110130904164567E-007  6.165130718275732E-007  6.223610345536756E-007
  6.282784081119133E-007  6.347854462720852E-007  6.416655223934390E-007
  6.425374792240063E-007  6.518916947527300E-007  6.615196029420712E-007
  6.710462543721832E-007  6.779537599405078E-007  6.832150836929839E-007
  1.485887675109245E-002  0.101301152128998       0.192842913115538
  0.288261717144609       0.410586225212846       0.567104111609461
  0.750865673296165       0.954964841291094        1.17256469087027
   1.39693899756850        1.62147709851657        1.83974371937518
   5.90219173052099        5.72045383050733        5.52942332795475
   5.33964213875681        5.16237601645325        4.98851212702143
   4.79097327138552        4.58829697326475        4.38163145548577
   4.17732627934004        3.98400314182262        3.81032497675204
   3.66491610553454        3.57114941381793        3.59987527391656

Although this may not be the best method (i.e. IF statement if not desirable for fast computing), this is it for now.