Dear all, I am not able to run a ncap2 command. First I calculate a 1D variable from an L3 mask like this: ncap2 -h -s 'data_occ=sst_mask.sum($lon,$lat); sst_diff=votemper' myfile I want to make some calculation along the time axis, based on a threshold value of the occurrence of observed data, like this: ncap2 -h -s 'for(*t=0;t<=time.size();t++){ if(data_occ(t)>5000) {mask_t=sst_mask(:,:,t);where(mask_t==1)sst_diff(:,:,t)=votemper(:,:,t)-adjusted_sea_surface_temperature(:,:,t)-273.15;elsewhere sst_diff(:,:,t)=votemper.get_miss();}...
Finally I managed to make it working. I degraded from 3D to 2D arrays to work with the where condition, like this: ncap2 -h -s ' for(*t=0;t<time.size();t++) { if(data_occ(t)>5000) {maskt=sst_mask(t,:,:); sst_difft=votemper(t,:,:); where(maskt == 1)sst_difft=votemper(t,:,:)-adjusted_sea_surface_temperature(t,:,:)-273.15;elsewhere sst_difft=votemper.get_miss();sst_diff(t,:,:)=sst_difft;} else{sst_diff(t,:,:)=votemper.get_miss();}; }' It works but it seems to me a workaroud. Any suggestion? Thank y...
I just realized that I missed the diemnsion order in the script(:,:,t) instead of the correct (t,:,:). But unfortunately, this doesn't change the result.
Dear all, I am not able to run a ncap2 command. First I calculate a 1D variable from an L3 mask like this: ncap2 -h -s 'data_occ=sst_mask.sum($lon,$lat); sst_diff=votemper' myfile I want to make some calculation along the time axis, based on a threshold value of the occurrence of observed data, like this: ncap2 -h -s 'for(*t=0;t<=time.size();t++){ if(data_occ(t)>5000) {mask_t=sst_mask(:,:,t);where(mask_t==1)sst_diff(:,:,t)=votemper(:,:,t)-adjusted_sea_surface_temperature(:,:,t)-273.15;elsewhere sst_diff(:,:,t)=votemper.get_miss();}...
Dear All, I am struggling if there is a simple way to accumulate the values of a variable along, let's say the time dimension. Suppose I have a file with lat,lon,time dimensions and a precipitation variable, I want to calculate the accumulated value along the time. Any hint? Thanks
HI, I have an integer variable that is a time-variable mask of satellite data due to cloud coverage. I want to calculate a (lat,lon) 2D field with the occurancy of the data. I tried: ncap2 -h -s 'data_occ=float(sst_mask.avg($time))' filename but it returns a 2D filed with zeros I think the problem is that the avg function is operating on an integer variable, so that the average somehow goes to zero, and the conversion to float is useless. If I do: ncap2 -h -s 'data_occ=float(sst_mask);data_occ=data_occ.avg($time)'...
The missing value is 0.0, and that contributes to the unexpected behavior. That is the point. I managed to do the mask removing the FillValue attribute from the variable with the previous command, but this is definitely a rude shortcut. You command works prefectly Thank you Charlie
Dear developers, I must create a mask from the analysed_sst variable, but I cannot make it. The files comes from a concatenation of multiple files and before the concatenation they where unpacked with ncpdq -U . The analysed_sst variable is populated with values and is missing on the land. I tried: ncap2 -O -s 'sst_mask=int(analysed_sst); where(analysed_sst>0) sst_mask=1; elsewhere(sst_mask=0)' infile outfile but it is all missing values . The only result I had similar to what I want is with: ncap2...