|
87 | 87 | concise = True |
88 | 88 | time_name = None |
89 | 89 | model_unit = "" |
90 | | - raw_extent = "foo" |
91 | 90 | xlim = "bar" |
92 | 91 | ylim = "ba" |
93 | 92 | if time_name is not None: |
|
144 | 143 | except: |
145 | 144 | model_unit = ds_obs.contents.unit[0] |
146 | 145 | model_unit = fix_unit(model_unit) |
147 | | - from oceanval.utils import get_extent |
148 | | - raw_extent = get_extent(ds_annual[0]) |
149 | | - if np.abs(raw_extent[0] - df_model.lon.min()) > 3: |
150 | | - # convert longitude to -180-180 |
151 | | - df_model["lon" ] = [x if x < 180 else x -360 for x in df_model.lon] |
152 | | - df_obs["lon" ] = [x if x < 180 else x -360 for x in df_obs.lon] |
153 | | - df_diff["lon" ] = [x if x < 180 else x -360 for x in df_diff.lon] |
| 146 | + df_model["lon" ] = [x if x < 180 else x -360 for x in df_model.lon] |
| 147 | + df_obs["lon" ] = [x if x < 180 else x -360 for x in df_obs.lon] |
| 148 | + df_diff["lon" ] = [x if x < 180 else x -360 for x in df_diff.lon] |
154 | 149 |
|
155 | 150 | # generate a temporary csv file name in /tmp |
156 | 151 | # create adhoc dir if not |
|
173 | 168 |
|
174 | 169 | # %% tags=["remove-input"] |
175 | 170 | # %%capture --no-display |
176 | | -# %%R -i model_unit -w 800 -h 600 -i variable -i raw_extent -i concise -r 100 |
| 171 | +# %%R -i model_unit -w 800 -h 600 -i variable -i concise -r 100 |
177 | 172 |
|
178 | 173 |
|
179 | 174 | if(concise == FALSE){ |
|
428 | 423 |
|
429 | 424 | # %% tags=["remove-input"] |
430 | 425 | # %%capture --no-display |
431 | | -# %%R -i model_unit -w 800 -h 600 -i variable -i raw_extent -i concise -r 100 |
| 426 | +# %%R -i model_unit -w 800 -h 600 -i variable -i concise -r 100 |
432 | 427 |
|
433 | 428 | if (concise == FALSE){ |
434 | 429 |
|
|
674 | 669 | b = 0, # Bottom margin |
675 | 670 | l = 0)) # Left ggmargin |
676 | 671 |
|
677 | | -# figure out if it's a global file |
678 | | -if(abs(raw_extent[1] - raw_extent[2]) > 350){ |
679 | | - gg1 <- gg1 + |
680 | | - scale_x_continuous(breaks = c(-180, -90, 0, 90, 180), labels = c("180°W", "90°W", "0°", "90°E", "180°E"))+ |
681 | | - scale_y_continuous(breaks = c(-90, -45, 0, 45, 90), labels = c("90°S", "45°S", "0°", "45°N", "90°N")) |
682 | 672 |
|
683 | | - gg2 <- gg2 + |
684 | | - scale_x_continuous(breaks = c(-180, -90, 0, 90, 180), labels = c("180°W", "90°W", "0°", "90°E", "180°E"))+ |
685 | | - scale_y_continuous(breaks = c(-90, -45, 0, 45, 90), labels = c("90°S", "45°S", "0°", "45°N", "90°N")) |
686 | | - |
687 | | - gg3 <- gg3 + |
688 | | - scale_x_continuous(breaks = c(-180, -90, 0, 90, 180), labels = c("180°W", "90°W", "0°", "90°E", "180°E"))+ |
689 | | - scale_y_continuous(breaks = c(-90, -45, 0, 45, 90), labels = c("90°S", "45°S", "0°", "45°N", "90°N")) |
690 | | - |
691 | | -} |
692 | | - |
693 | | -# appropriate plotting for northwest European Shelf |
694 | | -if((raw_extent[1] > -30) & (raw_extent[2] < 20)){ |
695 | | - gg1 <- gg1 + |
696 | | - scale_x_continuous(breaks = c(-20, -10, 0, 10), labels = c("20°W", "10°W", "0°", "10°E"))+ |
697 | | - scale_y_continuous(breaks = c(45, 50, 55, 60, 65), labels = c("45°N", "50°N", "55°N", "60°N", "65°N")) |
698 | | - gg2 <- gg2 + |
699 | | - scale_x_continuous(breaks = c(-20, -10, 0, 10), labels = c("20°W", "10°W", "0°", "10°E"))+ |
700 | | - scale_y_continuous(breaks = c(45, 50, 55, 60, 65), labels = c("45°N", "50°N", "55°N", "60°N", "65°N")) |
701 | | - gg3 <- gg3 + |
702 | | - scale_x_continuous(breaks = c(-20, -10, 0, 10), labels = c("20°W", "10°W", "0°", "10°E"))+ |
703 | | - scale_y_continuous(breaks = c(45, 50, 55, 60, 65), labels = c("45°N", "50°N", "55°N", "60°N", "65°N")) |
704 | | -} |
705 | | - |
706 | | -# gg1 |
707 | | -# reduce the size of the plot |
708 | | -# options(repr.plot.width = 10, repr.plot.height = 3) |
709 | | -# gg1 |
710 | 673 | cowplot::plot_grid(gg1, gg2, gg3, ncol = 1) |
711 | 674 |
|
712 | 675 | } |
|
0 commit comments